Class AuthIdHelper
- java.lang.Object
-
- org.forgerock.openam.core.rest.authn.AuthIdHelper
-
@Singleton public class AuthIdHelper extends Object
Helper class to create and verify authentication JWTs.
-
-
Constructor Summary
Constructors Constructor Description AuthIdHelper(CoreServicesWrapper coreServicesWrapper, org.forgerock.json.jose.builders.JwtBuilderFactory jwtBuilderFactory, org.forgerock.json.jose.jws.SigningManager signingManager)Constructs an instance of the AuthIdHelper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcreateAuthId(LoginConfiguration loginConfiguration, AuthenticationContext authContext)Creates a JWT authentication id.org.forgerock.json.jose.jws.SignedJwtreconstructAuthId(String authId)Reconstructs the Auth Id from a String to a JWT.voidverifyAuthId(String realmDN, String authId)Verifies the signature of the JWT, to ensure the JWT is valid.
-
-
-
Constructor Detail
-
AuthIdHelper
@Inject public AuthIdHelper(CoreServicesWrapper coreServicesWrapper, org.forgerock.json.jose.builders.JwtBuilderFactory jwtBuilderFactory, org.forgerock.json.jose.jws.SigningManager signingManager)
Constructs an instance of the AuthIdHelper.- Parameters:
coreServicesWrapper- An instance of the CoreServicesWrapper.jwtBuilderFactory- An instance of the JwtBuilderFactory.signingManager- An instance of the SigningManager.
-
-
Method Detail
-
createAuthId
public String createAuthId(LoginConfiguration loginConfiguration, AuthenticationContext authContext) throws SignatureException, RestAuthException
Creates a JWT authentication id.- Parameters:
loginConfiguration- The Login Configuration used in the login process.authContext- The underlying AuthContextLocal object.- Returns:
- The authentication id JWT.
- Throws:
SignatureException- If there is a problem signing or verifying the JWT.RestAuthException
-
reconstructAuthId
public org.forgerock.json.jose.jws.SignedJwt reconstructAuthId(String authId) throws RestAuthException
Reconstructs the Auth Id from a String to a JWT.- Parameters:
authId- The Auth Id jwt string- Returns:
- The JWT object.
- Throws:
RestAuthException
-
verifyAuthId
public void verifyAuthId(String realmDN, String authId) throws RestAuthException
Verifies the signature of the JWT, to ensure the JWT is valid.- Parameters:
realmDN- The DN for the realm being authenticated against.authId- The authentication id JWT.- Throws:
RestAuthException
-
-