keycloak-service
公開メンバ関数 | 非公開メンバ関数 | 非公開変数類 | 全メンバ一覧
org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean クラス
org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean 連携図
Collaboration graph

公開メンバ関数

 ResourceBean (Resource resource)
 
String getId ()
 
String getName ()
 
String getDisplayName ()
 
String getIconUri ()
 
UserModel getOwner ()
 
List< ScopeRepresentation > getScopes ()
 
Collection< RequesterBeangetShares ()
 
Collection< ManagedPermissionBeangetPolicies ()
 
ResourceServerBean getResourceServer ()
 
Collection< RequesterBeangetPermissions ()
 

非公開メンバ関数

void addPermission (PermissionTicket ticket, AuthorizationProvider authorization)
 

非公開変数類

final ResourceServerBean resourceServer
 
final UserModel owner
 
Resource resource
 
Map< String, RequesterBeanpermissions = new HashMap<>()
 
Collection< RequesterBeanshares
 

詳解

構築子と解体子

◆ ResourceBean()

org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.ResourceBean ( Resource  resource)
inline
230  {
231  RealmModel realm = authorization.getRealm();
232  resourceServer = new ResourceServerBean(realm.getClientById(resource.getResourceServer().getId()));
233  this.resource = resource;
234  owner = authorization.getKeycloakSession().users().getUserById(resource.getOwner(), realm);
235  }
final AuthorizationProvider authorization
Definition: AuthorizationBean.java:52
final ResourceServerBean resourceServer
Definition: AuthorizationBean.java:224
final UserModel owner
Definition: AuthorizationBean.java:225

関数詳解

◆ addPermission()

void org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.addPermission ( PermissionTicket  ticket,
AuthorizationProvider  authorization 
)
inlineprivate
307  {
308  permissions.computeIfAbsent(ticket.getRequester(), key -> new RequesterBean(ticket, authorization)).addScope(ticket);
309  }
final AuthorizationProvider authorization
Definition: AuthorizationBean.java:52
Map< String, RequesterBean > permissions
Definition: AuthorizationBean.java:227

◆ getDisplayName()

String org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.getDisplayName ( )
inline
245  {
246  return resource.getDisplayName();
247  }

◆ getIconUri()

String org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.getIconUri ( )
inline
249  {
250  return resource.getIconUri();
251  }

◆ getId()

String org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.getId ( )
inline
237  {
238  return resource.getId();
239  }

◆ getName()

String org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.getName ( )
inline
241  {
242  return resource.getName();
243  }

◆ getOwner()

UserModel org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.getOwner ( )
inline
253  {
254  return owner;
255  }
final UserModel owner
Definition: AuthorizationBean.java:225

◆ getPermissions()

Collection<RequesterBean> org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.getPermissions ( )
inline
303  {
304  return permissions.values();
305  }
Map< String, RequesterBean > permissions
Definition: AuthorizationBean.java:227

◆ getPolicies()

Collection<ManagedPermissionBean> org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.getPolicies ( )
inline
274  {
275  Map<String, String[]> filters = new HashMap<>();
276 
277  filters.put("type", new String[] {"uma"});
278  filters.put("resource", new String[] {this.resource.getId()});
279  filters.put("owner", new String[] {getOwner().getId()});
280 
281  List<Policy> policies = authorization.getStoreFactory().getPolicyStore().findByResourceServer(filters, getResourceServer().getId(), -1, -1);
282 
283  if (policies.isEmpty()) {
284  return Collections.emptyList();
285  }
286 
287  return policies.stream()
288  .filter(policy -> {
289  Map<String, String> filters1 = new HashMap<>();
290 
291  filters1.put(PermissionTicket.POLICY, policy.getId());
292 
293  return authorization.getStoreFactory().getPermissionTicketStore().find(filters1, resourceServer.getId(), -1, 1)
294  .isEmpty();
295  })
296  .map(ManagedPermissionBean::new).collect(Collectors.toList());
297  }
final AuthorizationProvider authorization
Definition: AuthorizationBean.java:52
ResourceServerBean getResourceServer()
Definition: AuthorizationBean.java:299
final ResourceServerBean resourceServer
Definition: AuthorizationBean.java:224
UserModel getOwner()
Definition: AuthorizationBean.java:253

◆ getResourceServer()

ResourceServerBean org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.getResourceServer ( )
inline
299  {
300  return resourceServer;
301  }
final ResourceServerBean resourceServer
Definition: AuthorizationBean.java:224

◆ getScopes()

List<ScopeRepresentation> org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.getScopes ( )
inline
257  {
258  return resource.getScopes().stream().map(ModelToRepresentation::toRepresentation).collect(Collectors.toList());
259  }

◆ getShares()

Collection<RequesterBean> org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.getShares ( )
inline
261  {
262  if (shares == null) {
263  Map<String, String> filters = new HashMap<>();
264 
265  filters.put(PermissionTicket.RESOURCE, this.resource.getId());
266  filters.put(PermissionTicket.GRANTED, Boolean.TRUE.toString());
267 
269  }
270 
271  return shares;
272  }
Collection< RequesterBean > shares
Definition: AuthorizationBean.java:228
Collection< RequesterBean > toPermissionRepresentation(List< PermissionTicket > permissionRequests)
Definition: AuthorizationBean.java:312
List< PermissionTicket > findPermissions(Map< String, String > filters)
Definition: AuthorizationBean.java:344

メンバ詳解

◆ owner

final UserModel org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.owner
private

◆ permissions

Map<String, RequesterBean> org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.permissions = new HashMap<>()
private

◆ resource

Resource org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.resource
private

◆ resourceServer

final ResourceServerBean org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.resourceServer
private

◆ shares

Collection<RequesterBean> org.keycloak.forms.account.freemarker.model.AuthorizationBean.ResourceBean.shares
private

このクラス詳解は次のファイルから抽出されました: