38
38
import org .apache .commons .lang .StringUtils ;
39
39
import org .slf4j .Logger ;
40
40
41
- import com .google .common .collect .Lists ;
42
-
43
41
/**
44
42
* @author Mougang T.Gasmyr
45
43
*
@@ -199,7 +197,7 @@ public Client setClientDefaultAttributes(Client client, boolean update) {
199
197
return client ;
200
198
}
201
199
202
- logger .debug ("client.getApplicationType:{}, client.getRedirectUris():{}, client.getClaimRedirectUris():{}" ,
200
+ logger .trace ("client.getApplicationType:{}, client.getRedirectUris():{}, client.getClaimRedirectUris():{}" ,
203
201
client .getApplicationType (), client .getRedirectUris (), client .getClaimRedirectUris ());
204
202
205
203
List <String > redirectUris = client .getRedirectUris () != null ? Arrays .asList (client .getRedirectUris ()) : null ;
@@ -214,15 +212,17 @@ public Client setClientDefaultAttributes(Client client, boolean update) {
214
212
claimsRedirectUris = new ArrayList <>(new HashSet <>(claimsRedirectUris )); // Remove repeated elements
215
213
client .setClaimRedirectUris (claimsRedirectUris .toArray (new String [0 ]));
216
214
}
217
-
215
+ logger .trace ("After setting client.getApplicationType:{}, client.getRedirectUris():{}, client.getClaimRedirectUris():{}" ,
216
+ client .getApplicationType (), client .getRedirectUris (), client .getClaimRedirectUris ());
217
+
218
218
client .setApplicationType (
219
219
client .getApplicationType () != null ? client .getApplicationType () : ApplicationType .WEB );
220
220
221
221
if (StringUtils .isNotBlank (client .getSectorIdentifierUri ())) {
222
222
client .setSectorIdentifierUri (client .getSectorIdentifierUri ());
223
223
}
224
224
225
- logger .debug ("client.getResponseTypes():{}, client.getGrantTypes():{}" , client .getResponseTypes (),
225
+ logger .trace ("client.getApplicationType():{}, client. getResponseTypes():{}, client.getGrantTypes():{}" , client . getApplicationType () , client .getResponseTypes (),
226
226
client .getGrantTypes ());
227
227
Set <ResponseType > responseTypeSet = client .getResponseTypes () != null
228
228
? new HashSet <>(Arrays .asList (client .getResponseTypes ()))
@@ -255,7 +255,9 @@ public Client setClientDefaultAttributes(Client client, boolean update) {
255
255
256
256
responseTypeSet .retainAll (appConfiguration .getAllResponseTypesSupported ());
257
257
grantTypeSet .retainAll (appConfiguration .getGrantTypesSupported ());
258
-
258
+ logger .trace ("After setting - client.getResponseTypes():{}, client.getGrantTypes():{}" , client .getResponseTypes (),
259
+ client .getGrantTypes ());
260
+
259
261
Set <GrantType > dynamicGrantTypeDefault = appConfiguration .getDynamicGrantTypeDefault ();
260
262
grantTypeSet .retainAll (dynamicGrantTypeDefault );
261
263
@@ -267,21 +269,21 @@ public Client setClientDefaultAttributes(Client client, boolean update) {
267
269
client .setGrantTypes (grantTypeSet .toArray (new GrantType [0 ]));
268
270
}
269
271
270
- logger .debug ("Set client.getResponseTypes():{}, client.getGrantTypes():{}" , client .getResponseTypes (),
272
+ logger .trace ("Set client.getResponseTypes():{}, client.getGrantTypes():{}" , client .getResponseTypes (),
271
273
client .getGrantTypes ());
272
274
List <String > contacts = client .getContacts () != null ? Arrays .asList (client .getContacts ()) : null ;
273
275
if (contacts != null && !contacts .isEmpty ()) {
274
276
contacts = new ArrayList <>(new HashSet <>(contacts )); // Remove repeated elements
275
277
client .setContacts (contacts .toArray (new String [0 ]));
276
278
}
277
279
278
- logger .debug ("client.getTokenEndpointAuthMethod():{}" , client .getTokenEndpointAuthMethod ());
280
+ logger .trace ("client.getTokenEndpointAuthMethod():{}" , client .getTokenEndpointAuthMethod ());
279
281
if (StringUtils .isBlank (client .getTokenEndpointAuthMethod ())) {
280
282
// If omitted, the default is client_secret_basic
281
283
client .setTokenEndpointAuthMethod (AuthenticationMethod .CLIENT_SECRET_BASIC .toString ());
282
284
}
283
285
284
- logger .debug ("client.getDefaultAcrValues():{}" , client .getDefaultAcrValues ());
286
+ logger .trace ("client.getDefaultAcrValues():{}" , client .getDefaultAcrValues ());
285
287
List <String > defaultAcrValues = client .getDefaultAcrValues () != null
286
288
? Arrays .asList (client .getDefaultAcrValues ())
287
289
: null ;
@@ -318,39 +320,16 @@ public Client setClientDefaultAttributes(Client client, boolean update) {
318
320
authorizedOrigins = new ArrayList <>(new HashSet <>(authorizedOrigins )); // Remove repeated elements
319
321
client .setAuthorizedOrigins (authorizedOrigins .toArray (new String [authorizedOrigins .size ()]));
320
322
}
321
-
322
- List <String > scopes = client .getScopes () != null ? Arrays .asList (client .getScopes ()) : null ;
323
- if (grantTypeSet .contains (GrantType .RESOURCE_OWNER_PASSWORD_CREDENTIALS )
324
- && !appConfiguration .getDynamicRegistrationAllowedPasswordGrantScopes ().isEmpty ()) {
325
- scopes = Lists .newArrayList (scopes );
326
- scopes .retainAll (appConfiguration .getDynamicRegistrationAllowedPasswordGrantScopes ());
327
- }
328
- List <String > scopesDn ;
329
- if (scopes != null && !scopes .isEmpty ()
330
- && isTrue (appConfiguration .getDynamicRegistrationScopesParamEnabled ())) {
331
- List <String > defaultScopes = scopeService .getDefaultScopesDn ();
332
- List <String > requestedScopes = scopeService .getScopesDn (scopes );
333
- Set <String > allowedScopes = new HashSet <>();
334
-
335
- for (String requestedScope : requestedScopes ) {
336
- if (defaultScopes .contains (requestedScope )) {
337
- allowedScopes .add (requestedScope );
338
- }
339
- }
340
-
341
- scopesDn = new ArrayList <>(allowedScopes );
342
- client .setScopes (scopesDn .toArray (new String [scopesDn .size ()]));
343
- } else {
344
- scopesDn = scopeService .getDefaultScopesDn ();
345
- client .setScopes (scopesDn .toArray (new String [scopesDn .size ()]));
346
- }
347
-
323
+
324
+ logger .debug ("client.getScopes():{}, appConfiguration.getDynamicRegistrationScopesParamEnabled():{}" ,client .getScopes (), appConfiguration .getDynamicRegistrationScopesParamEnabled ());
325
+
348
326
List <String > claims = client .getClaims () != null ? Arrays .asList (client .getClaims ()) : null ;
349
327
if (claims != null && !claims .isEmpty ()) {
350
328
List <String > claimsDn = attributeService .getAttributesDn (claims );
351
329
client .setClaims (claimsDn .toArray (new String [claimsDn .size ()]));
352
330
}
353
-
331
+ logger .debug ("client.getClaims():{}, client.getAttributes().getAuthorizedAcrValues():{}" ,client .getClaims (), client .getAttributes ().getAuthorizedAcrValues ());
332
+
354
333
List <String > authorizedAcrValues = client .getAttributes ().getAuthorizedAcrValues ();
355
334
if (authorizedAcrValues != null && !authorizedAcrValues .isEmpty ()) {
356
335
authorizedAcrValues = new ArrayList <>(new HashSet <>(authorizedAcrValues )); // Remove repeated elements
0 commit comments