Package com.nimbusds.oauth2.sdk.id

Examples of com.nimbusds.oauth2.sdk.id.State


    ResponseType responseType = resp.impliedResponseType();
    assertTrue(new ResponseType("token").equals(responseType));

    Map<String,String> params = resp.toParameters();
    assertEquals(TOKEN.getValue(), params.get("access_token"));
    assertEquals(STATE, new State(params.get("state")));
    assertEquals(TOKEN.getType(), new AccessTokenType(params.get("token_type")));
    assertEquals("3600", params.get("expires_in"));
    assertEquals(4, params.size());

    URI uri = resp.toURI();
View Full Code Here


      }
    }


    // Parse optional state third
    State state = State.parse(params.get("state"));


    // Parse mandatory response type
    v = params.get("response_type");
View Full Code Here

  public void testParseSuccess()
    throws Exception {

    URI redirectURI = new URI("https://example.com/in");
    AuthorizationCode code = new AuthorizationCode("123");
    State state = new State("xyz");

    AuthenticationSuccessResponse successResponse = new AuthenticationSuccessResponse(redirectURI, code, null, null, state);

    HTTPResponse httpResponse = successResponse.toHTTPResponse();
View Full Code Here

  public void testParseError()
    throws Exception {

    URI redirectURI = new URI("https://example.com/in");
    ResponseType rt = new ResponseType(ResponseType.Value.CODE);
    State state = new State("xyz");

    AuthenticationErrorResponse errorResponse = new AuthenticationErrorResponse(redirectURI, OAuth2Error.ACCESS_DENIED, rt, state);

    HTTPResponse httpResponse = errorResponse.toHTTPResponse();
View Full Code Here

    ErrorObject error = new ErrorObject(errorCode, errorDescription, HTTPResponse.SC_FOUND, errorURI);
   
   
    // State
    State state = State.parse(params.get("state"));
   
    return new AuthorizationErrorResponse(redirectURI, error, null, state);
  }
View Full Code Here

      new URI("https://c2id.com/login"),
      ResponseType.parse("code"),
      Scope.parse("openid email"),
      new ClientID("123"),
      new URI("https://client.com/cb"),
      new State(),
      new Nonce());

    ClaimsRequest claimsRequest = ClaimsRequest.resolve(authRequest);

    assertTrue(claimsRequest.getIDTokenClaims().isEmpty());
View Full Code Here

      new URI("https://c2id.com/login"),
      ResponseType.parse("id_token"),
      Scope.parse("openid email"),
      new ClientID("123"),
      new URI("https://client.com/cb"),
      new State(),
      new Nonce());

    ClaimsRequest claimsRequest = ClaimsRequest.resolve(authRequest);

    assertTrue(claimsRequest.getUserInfoClaims().isEmpty());
View Full Code Here

      new URI("https://c2id.com/login"),
      new ResponseType("code"),
      Scope.parse("openid profile"),
      new ClientID("abc"),
      new URI("https://example.com/in"),
      new State(),
      new Nonce());
   
    ACRRequest acrRequest = ACRRequest.resolve(authRequest);
   
    assertNull(acrRequest.getEssentialACRs());
View Full Code Here

    throws Exception {
 
    ResponseType rts = new ResponseType();
    rts.add(ResponseType.Value.CODE);

    State state = new State("xyz");
 
    AuthorizationErrorResponse r = new AuthorizationErrorResponse(REDIRECT_URI,
                                                                  OAuth2Error.INVALID_REQUEST,
                        rts,
                        state);

    assertEquals(REDIRECT_URI, r.getRedirectionURI());
    assertEquals(OAuth2Error.INVALID_REQUEST, r.getErrorObject());
    assertEquals(rts, r.getResponseType());
    assertEquals(state, r.getState());

    Map<String,String> params = r.toParameters();
    assertEquals(OAuth2Error.INVALID_REQUEST.getCode(), params.get("error"));
    assertEquals(OAuth2Error.INVALID_REQUEST.getDescription(), params.get("error_description"));
    assertNull(params.get("error_uri"));
    assertEquals(state.toString(), params.get("state"));
    assertEquals(3, params.size());

    URI location = r.toURI();
     
    System.out.println(location.toString());
    assertNull(location.getFragment());
    assertNotNull(location.getQuery());
     
    assertEquals(REDIRECT_URI.getScheme(), location.getScheme());
    assertEquals(REDIRECT_URI.getPort(), location.getPort());
    assertEquals(REDIRECT_URI.getHost(), location.getHost());
    assertEquals(REDIRECT_URI.getPath(), location.getPath());
     
    params = URLUtils.parseParameters(location.getQuery());
     
    assertEquals(OAuth2Error.INVALID_REQUEST.getCode(), params.get("error"));
    assertEquals(OAuth2Error.INVALID_REQUEST.getDescription(), params.get("error_description"));
    assertEquals(state.toString(), params.get("state"));
    assertEquals(3, params.size());
     
    HTTPResponse httpResponse = r.toHTTPResponse();
     
    assertEquals(HTTPResponse.SC_FOUND, httpResponse.getStatusCode());
View Full Code Here

    throws Exception {

    URI redirectURI = new URI("https://client.com/cb");
    ErrorObject error = OAuth2Error.ACCESS_DENIED;
    ResponseType responseType = new ResponseType("code");
    State state = new State();

    AuthorizationErrorResponse response = new AuthorizationErrorResponse(
      redirectURI, error, responseType, state);

    assertEquals(redirectURI, response.getRedirectionURI());
View Full Code Here

TOP

Related Classes of com.nimbusds.oauth2.sdk.id.State

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.