use of com.nimbusds.openid.connect.sdk.AuthenticationRequest in project di-authentication-api by alphagov.
the class AuthCodeHandlerTest method generateAuthRequest.
private static AuthenticationRequest generateAuthRequest(SignedJWT signedJWT) {
Scope scope = new Scope();
scope.add(OIDCScopeValue.OPENID);
AuthenticationRequest.Builder builder = new AuthenticationRequest.Builder(ResponseType.CODE, scope, CLIENT_ID, REDIRECT_URI).requestObject(signedJWT);
return builder.build();
}
use of com.nimbusds.openid.connect.sdk.AuthenticationRequest in project di-authentication-api by alphagov.
the class IPVCallbackHandlerTest method generateAuthRequest.
public static AuthenticationRequest generateAuthRequest() {
ResponseType responseType = new ResponseType(ResponseType.Value.CODE);
Scope scope = new Scope();
Nonce nonce = new Nonce();
scope.add(OIDCScopeValue.OPENID);
scope.add("phone");
scope.add("email");
return new AuthenticationRequest.Builder(responseType, scope, CLIENT_ID, REDIRECT_URI).state(RP_STATE).nonce(nonce).build();
}
use of com.nimbusds.openid.connect.sdk.AuthenticationRequest in project di-authentication-api by alphagov.
the class VerifyCodeIntegrationTest method setUpTestWithoutSignUp.
private void setUpTestWithoutSignUp(String sessionId, Scope scope) throws Json.JsonException {
redis.addEmailToSession(sessionId, EMAIL_ADDRESS);
AuthenticationRequest authRequest = new AuthenticationRequest.Builder(ResponseType.CODE, scope, new ClientID(CLIENT_ID), URI.create(REDIRECT_URI)).nonce(new Nonce()).state(new State()).build();
redis.createClientSession(CLIENT_SESSION_ID, authRequest.toParameters());
clientStore.registerClient(CLIENT_ID, "test-client", singletonList("redirect-url"), singletonList(EMAIL_ADDRESS), List.of("openid", "email", "phone"), "public-key", singletonList("http://localhost/post-redirect-logout"), "http://example.com", String.valueOf(ServiceType.MANDATORY), "https://test.com", "public", true);
}
use of com.nimbusds.openid.connect.sdk.AuthenticationRequest in project dataverse by IQSS.
the class OIDCAuthProvider method buildAuthzUrl.
/**
* Create the authz URL for the OIDC provider
* @param state A randomized state, necessary to secure the authorization flow. @see OAuth2LoginBackingBean.createState()
* @param callbackUrl URL where the provider should send the browser after authn in code flow
* @return
*/
@Override
public String buildAuthzUrl(String state, String callbackUrl) {
State stateObject = new State(state);
URI callback = URI.create(callbackUrl);
Nonce nonce = new Nonce();
AuthenticationRequest req = new AuthenticationRequest.Builder(new ResponseType("code"), Scope.parse(this.scope), this.clientAuth.getClientID(), callback).endpointURI(idpMetadata.getAuthorizationEndpointURI()).state(stateObject).nonce(nonce).build();
return req.toURI().toString();
}
use of com.nimbusds.openid.connect.sdk.AuthenticationRequest in project Kustvakt by KorAP.
the class OpenIdAuthorizationService method requestAuthorizationCode.
public URI requestAuthorizationCode(MultivaluedMap<String, String> map, String username, boolean isAuthentication, ZonedDateTime authenticationTime) throws KustvaktException, ParseException {
AuthorizationCode code = new AuthorizationCode();
URI redirectUri = null;
if (isAuthentication) {
AuthenticationRequest authRequest = null;
authRequest = AuthenticationRequest.parse((Map<String, List<String>>) map);
redirectUri = handleAuthenticationRequest(authRequest, code, username, authenticationTime);
return new AuthenticationSuccessResponse(redirectUri, code, null, null, authRequest.getState(), null, null).toURI();
} else {
AuthorizationRequest authzRequest = AuthorizationRequest.parse((Map<String, List<String>>) map);
redirectUri = handleAuthorizationRequest(authzRequest, code, username, authenticationTime, null);
return new AuthorizationSuccessResponse(redirectUri, code, null, authzRequest.getState(), null).toURI();
}
}
Aggregations