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

クラス

class  ApplicationEntry
 
class  ClientRoleEntry
 

公開メンバ関数

 ApplicationsBean (KeycloakSession session, RealmModel realm, UserModel user)
 
List< ApplicationEntrygetApplications ()
 

非公開メンバ関数

void processRoles (Set< RoleModel > inputRoles, List< RoleModel > realmRoles, MultivaluedHashMap< String, ClientRoleEntry > clientRoles)
 

非公開変数類

List< ApplicationEntryapplications = new LinkedList<ApplicationEntry>()
 

詳解

著者
Marek Posolda

構築子と解体子

◆ ApplicationsBean()

org.keycloak.forms.account.freemarker.model.ApplicationsBean.ApplicationsBean ( KeycloakSession  session,
RealmModel  realm,
UserModel  user 
)
inline
51  {
52 
53  Set<ClientModel> offlineClients = new UserSessionManager(session).findClientsWithOfflineToken(realm, user);
54 
55  List<ClientModel> realmClients = realm.getClients();
56  for (ClientModel client : realmClients) {
57  // Don't show bearerOnly clients
58  if (client.isBearerOnly()) {
59  continue;
60  }
61 
62  Set<RoleModel> availableRoles = new HashSet<>();
63  if (client.getClientId().equals(Constants.ADMIN_CLI_CLIENT_ID)
64  || client.getClientId().equals(Constants.ADMIN_CONSOLE_CLIENT_ID)) {
65  if (!AdminPermissions.realms(session, realm, user).isAdmin()) continue;
66 
67  } else {
68  // Construct scope parameter with all optional scopes to see all potentially available roles
69  Set<ClientScopeModel> allClientScopes = new HashSet<>(client.getClientScopes(true, true).values());
70  allClientScopes.addAll(client.getClientScopes(false, true).values());
71  allClientScopes.add(client);
72 
73  availableRoles = TokenManager.getAccess(user, client, allClientScopes);
74  }
75  List<RoleModel> realmRolesAvailable = new LinkedList<RoleModel>();
76  MultivaluedHashMap<String, ClientRoleEntry> resourceRolesAvailable = new MultivaluedHashMap<String, ClientRoleEntry>();
77  processRoles(availableRoles, realmRolesAvailable, resourceRolesAvailable);
78 
79  List<ClientScopeModel> orderedScopes = new ArrayList<>();
80  if (client.isConsentRequired()) {
81  UserConsentModel consent = session.users().getConsentByClient(realm, user.getId(), client.getId());
82 
83  if (consent != null) {
84  orderedScopes.addAll(consent.getGrantedClientScopes());
85  orderedScopes.sort(new OrderedModel.OrderedModelComparator<>());
86  }
87  }
88  List<String> clientScopesGranted = orderedScopes.stream()
89  .map(ClientScopeModel::getConsentScreenText)
90  .collect(Collectors.toList());
91 
92  List<String> additionalGrants = new ArrayList<>();
93  if (offlineClients.contains(client)) {
94  additionalGrants.add("${offlineToken}");
95  }
96 
97  ApplicationEntry appEntry = new ApplicationEntry(realmRolesAvailable, resourceRolesAvailable, client,
98  clientScopesGranted, additionalGrants);
99  applications.add(appEntry);
100  }
101  }
List< ApplicationEntry > applications
Definition: ApplicationsBean.java:49
void processRoles(Set< RoleModel > inputRoles, List< RoleModel > realmRoles, MultivaluedHashMap< String, ClientRoleEntry > clientRoles)
Definition: ApplicationsBean.java:103

関数詳解

◆ getApplications()

List<ApplicationEntry> org.keycloak.forms.account.freemarker.model.ApplicationsBean.getApplications ( )
inline
116  {
117  return applications;
118  }
List< ApplicationEntry > applications
Definition: ApplicationsBean.java:49

◆ processRoles()

void org.keycloak.forms.account.freemarker.model.ApplicationsBean.processRoles ( Set< RoleModel >  inputRoles,
List< RoleModel >  realmRoles,
MultivaluedHashMap< String, ClientRoleEntry clientRoles 
)
inlineprivate
103  {
104  for (RoleModel role : inputRoles) {
105  if (role.getContainer() instanceof RealmModel) {
106  realmRoles.add(role);
107  } else {
108  ClientModel currentClient = (ClientModel) role.getContainer();
109  ClientRoleEntry clientRole = new ClientRoleEntry(currentClient.getClientId(), currentClient.getName(),
110  role.getName(), role.getDescription());
111  clientRoles.add(currentClient.getClientId(), clientRole);
112  }
113  }
114  }

メンバ詳解

◆ applications

List<ApplicationEntry> org.keycloak.forms.account.freemarker.model.ApplicationsBean.applications = new LinkedList<ApplicationEntry>()
private

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