added null checks to endpoint auth method switches, closes #652
parent
863dbd17b8
commit
39c50b76f4
|
@ -97,7 +97,15 @@ public class JwtBearerAuthenticationProvider implements AuthenticationProvider {
|
||||||
throw new InvalidClientException("Client's registered request object signing algorithm (" + client.getRequestObjectSigningAlg() + ") does not match request object's actual algorithm (" + alg.getName() + ")");
|
throw new InvalidClientException("Client's registered request object signing algorithm (" + client.getRequestObjectSigningAlg() + ") does not match request object's actual algorithm (" + alg.getName() + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client.getTokenEndpointAuthMethod().equals(AuthMethod.PRIVATE_KEY) &&
|
if (client.getTokenEndpointAuthMethod() == null ||
|
||||||
|
client.getTokenEndpointAuthMethod().equals(AuthMethod.NONE) ||
|
||||||
|
client.getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_BASIC) ||
|
||||||
|
client.getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_POST)) {
|
||||||
|
|
||||||
|
// this client doesn't support this type of authentication
|
||||||
|
throw new AuthenticationServiceException("Client does not support this authentication method.");
|
||||||
|
|
||||||
|
} else if (client.getTokenEndpointAuthMethod().equals(AuthMethod.PRIVATE_KEY) &&
|
||||||
(alg.equals(JWSAlgorithm.RS256)
|
(alg.equals(JWSAlgorithm.RS256)
|
||||||
|| alg.equals(JWSAlgorithm.RS384)
|
|| alg.equals(JWSAlgorithm.RS384)
|
||||||
|| alg.equals(JWSAlgorithm.RS512))) {
|
|| alg.equals(JWSAlgorithm.RS512))) {
|
||||||
|
|
|
@ -161,7 +161,13 @@ public class ClientAPI {
|
||||||
client = clientService.generateClientId(client);
|
client = clientService.generateClientId(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client.getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_BASIC)
|
if (client.getTokenEndpointAuthMethod() == null ||
|
||||||
|
client.getTokenEndpointAuthMethod().equals(AuthMethod.NONE)) {
|
||||||
|
// we shouldn't have a secret for this client
|
||||||
|
|
||||||
|
client.setClientSecret(null);
|
||||||
|
|
||||||
|
} else if (client.getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_BASIC)
|
||||||
|| client.getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_POST)
|
|| client.getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_POST)
|
||||||
|| client.getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_JWT)) {
|
|| client.getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_JWT)) {
|
||||||
|
|
||||||
|
@ -183,11 +189,6 @@ public class ClientAPI {
|
||||||
// otherwise we shouldn't have a secret for this client
|
// otherwise we shouldn't have a secret for this client
|
||||||
client.setClientSecret(null);
|
client.setClientSecret(null);
|
||||||
|
|
||||||
} else if (client.getTokenEndpointAuthMethod().equals(AuthMethod.NONE)) {
|
|
||||||
// we shouldn't have a secret for this client
|
|
||||||
|
|
||||||
client.setClientSecret(null);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
logger.error("unknown auth method");
|
logger.error("unknown auth method");
|
||||||
|
@ -256,7 +257,13 @@ public class ClientAPI {
|
||||||
client = clientService.generateClientId(client);
|
client = clientService.generateClientId(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client.getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_BASIC)
|
if (client.getTokenEndpointAuthMethod() == null ||
|
||||||
|
client.getTokenEndpointAuthMethod().equals(AuthMethod.NONE)) {
|
||||||
|
// we shouldn't have a secret for this client
|
||||||
|
|
||||||
|
client.setClientSecret(null);
|
||||||
|
|
||||||
|
} else if (client.getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_BASIC)
|
||||||
|| client.getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_POST)
|
|| client.getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_POST)
|
||||||
|| client.getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_JWT)) {
|
|| client.getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_JWT)) {
|
||||||
|
|
||||||
|
@ -278,11 +285,6 @@ public class ClientAPI {
|
||||||
// otherwise we shouldn't have a secret for this client
|
// otherwise we shouldn't have a secret for this client
|
||||||
client.setClientSecret(null);
|
client.setClientSecret(null);
|
||||||
|
|
||||||
} else if (client.getTokenEndpointAuthMethod().equals(AuthMethod.NONE)) {
|
|
||||||
// we shouldn't have a secret for this client
|
|
||||||
|
|
||||||
client.setClientSecret(null);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
logger.error("unknown auth method");
|
logger.error("unknown auth method");
|
||||||
|
|
Loading…
Reference in New Issue