Search in sources :

Example 1 with JWTCallerPrincipalFactory

use of org.wildfly.swarm.microprofile.jwtauth.deployment.principal.JWTCallerPrincipalFactory in project wildfly-swarm by wildfly-swarm.

the class TCKTokenParser method parse.

@Override
public JsonWebToken parse(String bearerToken, String issuer, PublicKey publicKey) throws Exception {
    JWTAuthContextInfo authContextInfo = new JWTAuthContextInfo((RSAPublicKey) publicKey, issuer);
    JWTCallerPrincipalFactory factory = DefaultJWTCallerPrincipalFactory.instance();
    return factory.parse(bearerToken, authContextInfo);
}
Also used : JWTCallerPrincipalFactory(org.wildfly.swarm.microprofile.jwtauth.deployment.principal.JWTCallerPrincipalFactory) DefaultJWTCallerPrincipalFactory(org.wildfly.swarm.microprofile.jwtauth.deployment.principal.DefaultJWTCallerPrincipalFactory) JWTAuthContextInfo(org.wildfly.swarm.microprofile.jwtauth.deployment.principal.JWTAuthContextInfo)

Example 2 with JWTCallerPrincipalFactory

use of org.wildfly.swarm.microprofile.jwtauth.deployment.principal.JWTCallerPrincipalFactory in project wildfly-swarm by wildfly-swarm.

the class JWTLoginModule method validate.

/**
 * Validate the bearer token passed in with the authorization header
 *
 * @param jwtCredential - the input bearer token
 * @return return the validated JWTCallerPrincipal
 * @throws ParseException - thrown on token parse or validation failure
 */
protected JWTCallerPrincipal validate(JWTCredential jwtCredential) throws ParseException {
    JWTCallerPrincipalFactory factory = JWTCallerPrincipalFactory.instance();
    JWTCallerPrincipal callerPrincipal = factory.parse(jwtCredential.getBearerToken(), jwtCredential.getAuthContextInfo());
    return callerPrincipal;
}
Also used : JWTCallerPrincipalFactory(org.wildfly.swarm.microprofile.jwtauth.deployment.principal.JWTCallerPrincipalFactory) JWTCallerPrincipal(org.wildfly.swarm.microprofile.jwtauth.deployment.principal.JWTCallerPrincipal)

Aggregations

JWTCallerPrincipalFactory (org.wildfly.swarm.microprofile.jwtauth.deployment.principal.JWTCallerPrincipalFactory)2 DefaultJWTCallerPrincipalFactory (org.wildfly.swarm.microprofile.jwtauth.deployment.principal.DefaultJWTCallerPrincipalFactory)1 JWTAuthContextInfo (org.wildfly.swarm.microprofile.jwtauth.deployment.principal.JWTAuthContextInfo)1 JWTCallerPrincipal (org.wildfly.swarm.microprofile.jwtauth.deployment.principal.JWTCallerPrincipal)1