public static boolean isGrantSupportedForClient(Client client, boolean canSupportPublicClients, String grantType) { if (grantType == null || !client.isConfidential() && !canSupportPublicClients) { return false; } List<String> allowedGrants = client.getAllowedGrantTypes(); return allowedGrants.isEmpty() || allowedGrants.contains(grantType); }
public static boolean isGrantSupportedForClient(Client client, boolean canSupportPublicClients, String grantType) { if (grantType == null || !client.isConfidential() && !canSupportPublicClients) { return false; } List<String> allowedGrants = client.getAllowedGrantTypes(); return allowedGrants.isEmpty() || allowedGrants.contains(grantType); }
state.append(SEP); state.append(client.getAllowedGrantTypes().toString()); state.append(SEP);
state.append(SEP); state.append(client.getAllowedGrantTypes().toString()); state.append(SEP);
public OAuthDataProviderImplJwt() throws Exception { super(DEFAULT_CONFIG_URL, BusFactory.getThreadDefaultBus(true), CLIENT_CACHE_KEY + "_" + Math.abs(new Random().nextInt()), CODE_GRANT_CACHE_KEY + "_" + Math.abs(new Random().nextInt()), ACCESS_TOKEN_CACHE_KEY + "_" + Math.abs(new Random().nextInt()), REFRESH_TOKEN_CACHE_KEY + "_" + Math.abs(new Random().nextInt()), true); Client client = new Client("boundJwt", null, true, null, null); client.getProperties().put(OAuthConstants.TLS_CLIENT_AUTH_SUBJECT_DN, "CN=whateverhost.com,OU=Morpit,O=ApacheTest,L=Syracuse,C=US"); client.getAllowedGrantTypes().add("custom_grant"); this.setClient(client); this.setUseJwtFormatForAccessTokens(true); }
client.getAllowedGrantTypes().add("authorization_code"); client.getAllowedGrantTypes().add("refresh_token"); client.getAllowedGrantTypes().add("implicit"); client.getAllowedGrantTypes().add("hybrid"); client.getAllowedGrantTypes().add("password"); client.getAllowedGrantTypes().add("client_credentials"); client.getAllowedGrantTypes().add("urn:ietf:params:oauth:grant-type:saml2-bearer"); client.getAllowedGrantTypes().add("urn:ietf:params:oauth:grant-type:jwt-bearer"); client.getAllowedGrantTypes().add("authorization_code"); client.getAllowedGrantTypes().add("refresh_token"); client.getAllowedGrantTypes().add("authorization_code"); client.getAllowedGrantTypes().add("refresh_token"); client.getAllowedGrantTypes().add("authorization_code"); client.getAllowedGrantTypes().add("refresh_token"); client.getAllowedGrantTypes().add(Constants.SAML2_BEARER_GRANT); client.getAllowedGrantTypes().add("urn:ietf:params:oauth:grant-type:jwt-bearer"); client.getAllowedGrantTypes().add("custom_grant"); this.setClient(client); client.getAllowedGrantTypes().add("custom_grant"); this.setClient(client); client.getAllowedGrantTypes().add("custom_grant"); this.setClient(client);
client.getAllowedGrantTypes().add("authorization_code"); client.getAllowedGrantTypes().add("refresh_token"); client.getAllowedGrantTypes().add("implicit"); client.getAllowedGrantTypes().add("hybrid"); client.getAllowedGrantTypes().add("password"); client.getAllowedGrantTypes().add("client_credentials"); client.getAllowedGrantTypes().add("urn:ietf:params:oauth:grant-type:saml2-bearer"); client.getAllowedGrantTypes().add("urn:ietf:params:oauth:grant-type:jwt-bearer"); client.getAllowedGrantTypes().add("authorization_code"); client.getAllowedGrantTypes().add("refresh_token"); client.getAllowedGrantTypes().add("authorization_code"); client.getAllowedGrantTypes().add("refresh_token"); client.getAllowedGrantTypes().add("authorization_code"); client.getAllowedGrantTypes().add("refresh_token"); client.getAllowedGrantTypes().add(Constants.SAML2_BEARER_GRANT); client.getAllowedGrantTypes().add("urn:ietf:params:oauth:grant-type:jwt-bearer"); client.getAllowedGrantTypes().add("custom_grant"); this.setClient(client); client.getAllowedGrantTypes().add("custom_grant"); this.setClient(client); client.getAllowedGrantTypes().add("custom_grant"); this.setClient(client);
public OAuthDataProviderImpl() throws Exception { Client client1 = new Client("CN=whateverhost.com,OU=Morpit,O=ApacheTest,L=Syracuse,C=US", null, true, null, null); client1.getAllowedGrantTypes().add("custom_grant"); registerCert(client1); this.setClient(client1); Client client2 = new Client("bound", null, true, null, null); client2.getProperties().put(OAuthConstants.TLS_CLIENT_AUTH_SUBJECT_DN, "CN=whateverhost.com,OU=Morpit,O=ApacheTest,L=Syracuse,C=US"); client2.getAllowedGrantTypes().add("custom_grant"); this.setClient(client2); Client client3 = new Client("unbound", null, true, null, null); this.setClient(client3); }
protected ClientRegistration fromClientToClientRegistration(Client c) { ClientRegistration reg = new ClientRegistration(); reg.setClientName(c.getApplicationName()); reg.setGrantTypes(c.getAllowedGrantTypes()); reg.setApplicationType(c.isConfidential() ? "web" : "native"); if (!c.getRedirectUris().isEmpty()) {
protected ClientRegistration fromClientToClientRegistration(Client c) { ClientRegistration reg = new ClientRegistration(); reg.setClientName(c.getApplicationName()); reg.setGrantTypes(c.getAllowedGrantTypes()); reg.setApplicationType(c.isConfidential() ? "web" : "native"); if (!c.getRedirectUris().isEmpty()) {
if (!client.getAllowedGrantTypes().isEmpty() && !client.getAllowedGrantTypes().contains(requestedGrant)) { throw new OAuthServiceException(OAuthConstants.INVALID_GRANT);
if (!client.getAllowedGrantTypes().isEmpty() && !client.getAllowedGrantTypes().contains(requestedGrant)) { throw new OAuthServiceException(OAuthConstants.INVALID_GRANT);