def createClient(self, registerRequest, client, configurationAttributes): print "Client registration. CreateClient method" redirectUris = client.getRedirectUris() print "Client registration. Redirect Uris: %s" % redirectUris addAddressScope = False for redirectUri in redirectUris: if (self.clientRedirectUrisSet.contains(redirectUri)): addAddressScope = True break print "Client registration. Is add address scope: %s" % addAddressScope if addAddressScope: currentScopes = client.getScopes() print "Client registration. Current scopes: %s" % currentScopes scopeService = CdiUtil.bean(ScopeService) addressScope = scopeService.getScopeByDisplayName("address") newScopes = ArrayHelper.addItemToStringArray( currentScopes, addressScope.getDn()) print "Client registration. Result scopes: %s" % newScopes client.setScopes(newScopes) return True
def setClientScopes(self, client, requiredScopes): if requiredScopes == None: print "Casa client registration. No list of scopes was passed in script parameters" return requiredScopes = StringHelper.split(requiredScopes.getValue2(), ",") newScopes = client.getScopes() scopeService = CdiUtil.bean(ScopeService) for scopeName in requiredScopes: scope = scopeService.getScopeById(scopeName) if not scope.isDefaultScope(): print "Casa client registration. Adding scope '%s'" % scopeName newScopes = ArrayHelper.addItemToStringArray(newScopes, scope.getDn()) print "Casa client registration. Result scopes are: %s" % newScopes client.setScopes(newScopes)
def createClient(self, registerRequest, client, configurationAttributes): print "Client registration. CreateClient method" #Temporary workaround for acceptance scripts #Forcefully adds the "automated" scope on dynamically registered clients print "Client registration. Adding 'automated' scope" automated_inum = "inum=03de78be-34e8-4a77-8af6-384dd90d9fa3,ou=scopes,o=gluu" currentScopes = client.getScopes() print "Client registration. Current scopes: %s" % currentScopes if not currentScopes: newScopes = [automated_inum] else: newScopes = ArrayHelper.addItemToStringArray(currentScopes, automated_inum) print "Client registration. Result scopes: %s" % newScopes client.setScopes(newScopes) client.setIncludeClaimsInIdToken(True) client.setRptAsJwt(True) return True