cleaned up spurious nosuchalgorithm exceptions, addresses #285
parent
5f7c46aecd
commit
e2ad4d2e8f
|
@ -55,12 +55,7 @@ public class SignedAuthRequestUrlBuilder implements AuthRequestUrlBuilder {
|
|||
|
||||
SignedJWT jwt = new SignedJWT(new JWSHeader(signingAndValidationService.getDefaultSigningAlgorithm()), claims);
|
||||
|
||||
try {
|
||||
signingAndValidationService.signJwt(jwt);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
signingAndValidationService.signJwt(jwt);
|
||||
|
||||
try {
|
||||
URIBuilder uriBuilder = new URIBuilder(serverConfig.getAuthorizationEndpointUri());
|
||||
|
|
|
@ -20,12 +20,13 @@ import java.security.PublicKey;
|
|||
import java.util.Map;
|
||||
|
||||
import com.nimbusds.jose.JWSAlgorithm;
|
||||
import com.nimbusds.jose.jwk.JWK;
|
||||
import com.nimbusds.jwt.SignedJWT;
|
||||
|
||||
public interface JwtSigningAndValidationService {
|
||||
|
||||
/**
|
||||
* Get all public keys for this service, mapped by their ID
|
||||
* Get all public keys for this service, mapped by their Key ID
|
||||
*/
|
||||
public Map<String, PublicKey> getAllPublicKeys();
|
||||
|
||||
|
@ -48,13 +49,13 @@ public interface JwtSigningAndValidationService {
|
|||
* @return the signed jwt
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
public void signJwt(SignedJWT jwt) throws NoSuchAlgorithmException;
|
||||
public void signJwt(SignedJWT jwt);
|
||||
|
||||
/**
|
||||
* Get the default signing algorithm for use when nothing else has been specified.
|
||||
* @return
|
||||
*/
|
||||
JWSAlgorithm getDefaultSigningAlgorithm();
|
||||
public JWSAlgorithm getDefaultSigningAlgorithm();
|
||||
|
||||
/**
|
||||
* Sign a jwt using the selected algorithm. The algorithm is selected using the String parameter values specified
|
||||
|
|
|
@ -55,9 +55,6 @@ public class JwtAssertionTokenGranter extends AbstractTokenGranter {
|
|||
/* (non-Javadoc)
|
||||
* @see org.springframework.security.oauth2.provider.token.AbstractTokenGranter#getOAuth2Authentication(org.springframework.security.oauth2.provider.AuthorizationRequest)
|
||||
*/
|
||||
/**
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
@Override
|
||||
protected OAuth2AccessToken getAccessToken(AuthorizationRequest authorizationRequest) throws AuthenticationException, InvalidTokenException {
|
||||
// read and load up the existing token
|
||||
|
@ -101,15 +98,7 @@ public class JwtAssertionTokenGranter extends AbstractTokenGranter {
|
|||
|
||||
|
||||
SignedJWT newIdToken = new SignedJWT((JWSHeader) idToken.getHeader(), claims);
|
||||
try {
|
||||
jwtService.signJwt(newIdToken);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
// TODO how to handle this exception?
|
||||
// Because of the abstract class's method signature, cannot add "throws"
|
||||
// declaration to this class, but printing a stack trace is not a good
|
||||
// fallback.
|
||||
e.printStackTrace();
|
||||
}
|
||||
jwtService.signJwt(newIdToken);
|
||||
|
||||
newIdTokenEntity.setJwt(newIdToken);
|
||||
newIdTokenEntity.setAuthenticationHolder(incomingToken.getAuthenticationHolder());
|
||||
|
|
|
@ -78,12 +78,7 @@ public class ConnectTokenEnhancer implements TokenEnhancer {
|
|||
|
||||
SignedJWT signed = new SignedJWT(new JWSHeader(jwtService.getDefaultSigningAlgorithm()), claims);
|
||||
|
||||
try {
|
||||
jwtService.signJwt(signed);
|
||||
} catch (NoSuchAlgorithmException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
jwtService.signJwt(signed);
|
||||
|
||||
token.setJwt(signed);
|
||||
|
||||
|
@ -129,13 +124,7 @@ public class ConnectTokenEnhancer implements TokenEnhancer {
|
|||
|
||||
//TODO: check for client's preferred signer alg and use that
|
||||
|
||||
try {
|
||||
jwtService.signJwt(idToken);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
jwtService.signJwt(idToken);
|
||||
|
||||
idTokenEntity.setJwt(idToken);
|
||||
|
||||
|
|
Loading…
Reference in New Issue