Fixed audience claim on client auth assertion
parent
8203aaaa35
commit
53cc7ef447
|
@ -340,7 +340,7 @@ public class OIDCAuthenticationFilter extends AbstractAuthenticationProcessingFi
|
||||||
|
|
||||||
claimsSet.setIssuer(clientConfig.getClientId());
|
claimsSet.setIssuer(clientConfig.getClientId());
|
||||||
claimsSet.setSubject(clientConfig.getClientId());
|
claimsSet.setSubject(clientConfig.getClientId());
|
||||||
claimsSet.setAudience(Lists.newArrayList(serverConfig.getIssuer()));
|
claimsSet.setAudience(Lists.newArrayList(serverConfig.getTokenEndpointUri()));
|
||||||
|
|
||||||
// TODO: make this configurable
|
// TODO: make this configurable
|
||||||
Date exp = new Date(System.currentTimeMillis() + (60 * 1000)); // auth good for 60 seconds
|
Date exp = new Date(System.currentTimeMillis() + (60 * 1000)); // auth good for 60 seconds
|
||||||
|
|
|
@ -174,8 +174,8 @@ public class JwtBearerAuthenticationProvider implements AuthenticationProvider {
|
||||||
// check audience
|
// check audience
|
||||||
if (jwtClaims.getAudience() == null) {
|
if (jwtClaims.getAudience() == null) {
|
||||||
throw new AuthenticationServiceException("Assertion token audience is null");
|
throw new AuthenticationServiceException("Assertion token audience is null");
|
||||||
} else if (!jwtClaims.getAudience().contains(config.getIssuer())) {
|
} else if (!(jwtClaims.getAudience().contains(config.getIssuer()) || jwtClaims.getAudience().contains(config.getIssuer() + "token"))) {
|
||||||
throw new AuthenticationServiceException("Audience does not match, expected " + config.getIssuer() + " got " + jwtClaims.getAudience());
|
throw new AuthenticationServiceException("Audience does not match, expected " + config.getIssuer() + " or " + (config.getIssuer() + "token") + " got " + jwtClaims.getAudience());
|
||||||
}
|
}
|
||||||
|
|
||||||
// IFF we managed to get all the way down here, the token is valid
|
// IFF we managed to get all the way down here, the token is valid
|
||||||
|
|
Loading…
Reference in New Issue