Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KEYCLOAK-1070 Support for view and revoke consents in admin console
- Loading branch information
Showing
18 changed files
with
315 additions
and
106 deletions.
There are no files selected for viewing
40 changes: 32 additions & 8 deletions
40
core/src/main/java/org/keycloak/representations/idm/UserConsentRepresentation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,28 +1,52 @@ | |||
package org.keycloak.representations.idm; | package org.keycloak.representations.idm; | ||
|
|
||
import java.util.List; | import java.util.List; | ||
import java.util.Map; | |||
|
|
||
/** | /** | ||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a> | * @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a> | ||
*/ | */ | ||
public class UserConsentRepresentation { | public class UserConsentRepresentation { | ||
|
|
||
protected List<String> grantedRoles; // points to roleIds | protected String clientId; | ||
protected List<String> grantedProtocolMappers; // points to protocolMapperIds | |||
|
|
||
public List<String> getGrantedRoles() { | // Key is protocol, Value is list of granted consents for this protocol | ||
return grantedRoles; | protected Map<String, List<String>> grantedProtocolMappers; | ||
|
|||
protected List<String> grantedRealmRoles; | |||
|
|||
// Key is clientId, Value is list of granted roles of this client | |||
protected Map<String, List<String>> grantedClientRoles; | |||
|
|||
public String getClientId() { | |||
return clientId; | |||
} | } | ||
|
|
||
public void setGrantedRoles(List<String> grantedRoles) { | public void setClientId(String clientId) { | ||
this.grantedRoles = grantedRoles; | this.clientId = clientId; | ||
} | } | ||
|
|
||
public List<String> getGrantedProtocolMappers() { | public Map<String, List<String>> getGrantedProtocolMappers() { | ||
return grantedProtocolMappers; | return grantedProtocolMappers; | ||
} | } | ||
|
|
||
public void setGrantedProtocolMappers(List<String> grantedProtocolMappers) { | public void setGrantedProtocolMappers(Map<String, List<String>> grantedProtocolMappers) { | ||
this.grantedProtocolMappers = grantedProtocolMappers; | this.grantedProtocolMappers = grantedProtocolMappers; | ||
} | } | ||
|
|||
public List<String> getGrantedRealmRoles() { | |||
return grantedRealmRoles; | |||
} | |||
|
|||
public void setGrantedRealmRoles(List<String> grantedRealmRoles) { | |||
this.grantedRealmRoles = grantedRealmRoles; | |||
} | |||
|
|||
public Map<String, List<String>> getGrantedClientRoles() { | |||
return grantedClientRoles; | |||
} | |||
|
|||
public void setGrantedClientRoles(Map<String, List<String>> grantedClientRoles) { | |||
this.grantedClientRoles = grantedClientRoles; | |||
} | |||
} | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 1 addition & 7 deletions
8
...s/common-themes/src/main/resources/theme/base/admin/resources/partials/role-mappings.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...s/common-themes/src/main/resources/theme/base/admin/resources/partials/user-consents.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,47 @@ | |||
<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div> | |||
<div id="content-area" class="col-md-9" role="main"> | |||
<kc-navigation-user></kc-navigation-user> | |||
<div id="content"> | |||
<ol class="breadcrumb"> | |||
<li><a href="#/realms/{{realm.realm}}/users">Users</a></li> | |||
<li><a href="#/realms/{{realm.realm}}/users/{{user.username}}">{{user.username}}</a></li> | |||
<li class="active">Consents</li> | |||
</ol> | |||
<h2>User <span>{{user.username}}</span> Consents <span tooltip-placement="right" tooltip="This page shows you all the consents, which user granted permissions" class="fa fa-info-circle"></span></h2> | |||
<table class="table table-striped table-bordered"> | |||
<thead> | |||
<tr> | |||
<th>Client</th> | |||
<th>Granted Roles</th> | |||
<th>Granted Protocol Mappers</th> | |||
<th>Action</th> | |||
</tr> | |||
</thead> | |||
<tbody> | |||
<tr data-ng-repeat="consent in userConsents"> | |||
<td>{{consent.clientId}}</td> | |||
<td> | |||
<span data-ng-repeat="realmRole in consent.grantedRealmRoles"> | |||
<span ng-if="!$first">, </span>{{realmRole}} | |||
</span> | |||
<span data-ng-repeat="(clientId, clientRoles) in consent.grantedClientRoles"> | |||
<span data-ng-repeat="clientRole in clientRoles"> | |||
<span ng-if="!$first || consent.grantedRealmRoles.length > 0">, </span>{{clientRole}} in {{clientId}} | |||
</span> | |||
</span> | |||
</td> | |||
<td> | |||
<span data-ng-repeat="protocol in consent.grantedProtocolMappers"> | |||
<span data-ng-repeat="protocolMapper in protocol"> | |||
<span ng-if="!$first">, </span>{{protocolMapper}} | |||
</span> | |||
</span> | |||
</td> | |||
<td> | |||
<button class="btn btn-danger" ng-click="revokeConsent(consent.clientId)">Revoke consent</button> | |||
</td> | |||
</tr> | |||
</tbody> | |||
</table> | |||
</div> | |||
</div> |
9 changes: 1 addition & 8 deletions
9
...ommon-themes/src/main/resources/theme/base/admin/resources/partials/user-credentials.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 1 addition & 8 deletions
9
forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-detail.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 1 addition & 7 deletions
8
...hemes/src/main/resources/theme/base/admin/resources/partials/user-federated-identity.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 1 addition & 7 deletions
8
...s/common-themes/src/main/resources/theme/base/admin/resources/partials/user-sessions.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...on-themes/src/main/resources/theme/base/admin/resources/templates/kc-navigation-user.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
<ul class="nav nav-tabs nav-tabs-pf" data-ng-hide="create"> | |||
<li ng-class="{active: !path[4]}"><a href="#/realms/{{realm.realm}}/users/{{user.username}}">Attributes</a></li> | |||
<li ng-class="{active: path[4] == 'user-credentials'}"><a href="#/realms/{{realm.realm}}/users/{{user.username}}/user-credentials">Credentials</a></li> | |||
<li ng-class="{active: path[4] == 'role-mappings'}"><a href="#/realms/{{realm.realm}}/users/{{user.username}}/role-mappings">Role Mappings</a></li> | |||
<li ng-class="{active: path[4] == 'sessions'}"><a href="#/realms/{{realm.realm}}/users/{{user.username}}/sessions">Sessions</a></li> | |||
<li ng-class="{active: path[4] == 'federated-identity'}" data-ng-show="realm.identityFederationEnabled"><a href="#/realms/{{realm.realm}}/users/{{user.username}}/federated-identity">Federated Identities</a></li> | |||
<li ng-class="{active: path[4] == 'consents'}"><a href="#/realms/{{realm.realm}}/users/{{user.username}}/consents">Consents</a></li> | |||
</ul> |
Oops, something went wrong.