Search in sources :

Example 1 with LangTag

use of com.nimbusds.langtag.LangTag in project OpenConext-oidcng by OpenConext.

the class JWTRequestTest method fullBlown.

@Test
public void fullBlown() throws Exception {
    OpenIDClient client = getClient();
    setCertificateFields(client, getStrippedCertificate(), null, null);
    String keyID = getCertificateKeyID(client);
    SignedJWT signedJWT = signedJWT(client.getClientId(), keyID, client.getRedirectUrls().get(0));
    ClaimsRequest claimsRequest = new ClaimsRequest();
    claimsRequest.addIDTokenClaim("email");
    List<LangTag> langTags = Collections.singletonList(new LangTag("en"));
    List<ACR> acrValues = Collections.singletonList(new ACR("loa"));
    AuthenticationRequest authenticationRequest = new AuthenticationRequest(new URI("http://localhost/authorize"), ResponseType.getDefault(), ResponseMode.FRAGMENT, new Scope("openid"), new ClientID(client.getClientId()), new URI(client.getRedirectUrls().get(0)), new State("state"), new Nonce("nonce"), Display.getDefault(), Prompt.parse("consent"), 1200, langTags, langTags, null, "hint", acrValues, claimsRequest, "purpose", signedJWT, null, CodeChallenge.compute(CodeChallengeMethod.S256, new CodeVerifier()), CodeChallengeMethod.S256, Collections.singletonList(new URI("http://localhost")), true, Collections.singletonMap("custom", Collections.singletonList("value")));
    authenticationRequest = JWTRequest.parse(authenticationRequest, client);
    assertEquals("login", authenticationRequest.getPrompt().toString());
}
Also used : OpenIDClient(oidc.model.OpenIDClient) SignedJWT(com.nimbusds.jwt.SignedJWT) ClaimsRequest(com.nimbusds.openid.connect.sdk.ClaimsRequest) URI(java.net.URI) ACR(com.nimbusds.openid.connect.sdk.claims.ACR) Nonce(com.nimbusds.openid.connect.sdk.Nonce) LangTag(com.nimbusds.langtag.LangTag) CodeVerifier(com.nimbusds.oauth2.sdk.pkce.CodeVerifier) Scope(com.nimbusds.oauth2.sdk.Scope) State(com.nimbusds.oauth2.sdk.id.State) ClientID(com.nimbusds.oauth2.sdk.id.ClientID) AuthenticationRequest(com.nimbusds.openid.connect.sdk.AuthenticationRequest) Test(org.junit.Test)

Aggregations

SignedJWT (com.nimbusds.jwt.SignedJWT)1 LangTag (com.nimbusds.langtag.LangTag)1 Scope (com.nimbusds.oauth2.sdk.Scope)1 ClientID (com.nimbusds.oauth2.sdk.id.ClientID)1 State (com.nimbusds.oauth2.sdk.id.State)1 CodeVerifier (com.nimbusds.oauth2.sdk.pkce.CodeVerifier)1 AuthenticationRequest (com.nimbusds.openid.connect.sdk.AuthenticationRequest)1 ClaimsRequest (com.nimbusds.openid.connect.sdk.ClaimsRequest)1 Nonce (com.nimbusds.openid.connect.sdk.Nonce)1 ACR (com.nimbusds.openid.connect.sdk.claims.ACR)1 URI (java.net.URI)1 OpenIDClient (oidc.model.OpenIDClient)1 Test (org.junit.Test)1