Package com.nimbusds.oauth2.sdk

Examples of com.nimbusds.oauth2.sdk.AuthorizationGrantTest


 
 
  public void testResolveToUserInfo()
    throws Exception {
   
    Scope scope = Scope.parse("openid email profile phone address");
   
    ClaimsRequest cr = ClaimsRequest.resolve(ResponseType.parse("code"), scope);
   
    System.out.println("Claims request for scope openid email profile phone address: " + cr.toJSONObject());
   
View Full Code Here



  public void testResolveToIDToken()
    throws Exception {

    Scope scope = Scope.parse("openid email profile phone address");

    ClaimsRequest cr = ClaimsRequest.resolve(ResponseType.parse("id_token"), scope);

    System.out.println("Claims request for scope openid email profile phone address: " + cr.toJSONObject());
View Full Code Here


  public void testResolveDependingOnResponseType()
    throws Exception {

    Scope scope = Scope.parse("openid email");

    ClaimsRequest cr = ClaimsRequest.resolve(ResponseType.parse("id_token code"), scope);

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

 
 
  public void testAdd()
    throws Exception {
   
    Scope scope = Scope.parse("openid profile");
   
    ClaimsRequest cr = ClaimsRequest.resolve(ResponseType.parse("code"), scope);

    System.out.println("Claims request for scope openid profile: " + cr.toJSONObject());
   
View Full Code Here

    ClaimsRequest cr = new ClaimsRequest();
    cr.addIDTokenClaim(new ClaimsRequest.Entry("email", ClaimRequirement.ESSENTIAL));

    AuthenticationRequest authRequest = new AuthenticationRequest.Builder(
      new ResponseType("code"),
      new Scope("openid", "email"),
      new ClientID("123"),
      new URI("https://client.com/cb")).claims(cr).build();

    ClaimsRequest claimsRequest = ClaimsRequest.resolve(authRequest);
View Full Code Here

  @Override
  public void applyTo(final HTTPRequest httpRequest)
    throws SerializeException {
 
    if (httpRequest.getMethod() != HTTPRequest.Method.POST)
      throw new SerializeException("The HTTP request method must be POST");
   
    ContentType ct = httpRequest.getContentType();
   
    if (ct == null)
      throw new SerializeException("Missing HTTP Content-Type header");
   
    if (! ct.match(CommonContentTypes.APPLICATION_URLENCODED))
      throw new SerializeException("The HTTP Content-Type header must be " + CommonContentTypes.APPLICATION_URLENCODED);
   
    Map <String,String> params = httpRequest.getQueryParameters();
   
    params.putAll(toParameters());
   
View Full Code Here

    try {
      params.put("client_assertion", clientAssertion.serialize());
   
    } catch (IllegalStateException e) {
   
      throw new SerializeException("Couldn't serialize JWT to a client assertion string: " + e.getMessage(), e);
   
   
    params.put("client_assertion_type", CLIENT_ASSERTION_TYPE);
   
    return params;
View Full Code Here

  @Override
  public void applyTo(final HTTPRequest httpRequest)
    throws SerializeException {
   
    if (httpRequest.getMethod() != HTTPRequest.Method.POST)
      throw new SerializeException("The HTTP request method must be POST");
   
    ContentType ct = httpRequest.getContentType();
   
    if (ct == null)
      throw new SerializeException("Missing HTTP Content-Type header");
   
    if (! ct.match(CommonContentTypes.APPLICATION_URLENCODED))
      throw new SerializeException("The HTTP Content-Type header must be " + CommonContentTypes.APPLICATION_URLENCODED);
   
    Map <String,String> params = httpRequest.getQueryParameters();
   
    params.putAll(toParameters());
   
View Full Code Here

    httpRequest.ensureMethod(HTTPRequest.Method.POST);
    httpRequest.ensureContentType(CommonContentTypes.APPLICATION_URLENCODED);

    // Parse client authentication, if any
    ClientAuthentication clientAuth = ClientAuthentication.parse(httpRequest);

    // No fragment! May use query component!
    Map<String,String> params = httpRequest.getQueryParameters();

    // Parse grant
View Full Code Here

  public void testWithAccessTokenAndClientAuth()
    throws Exception {

    URI endpointURI = new URI("https://c2id.com/token/revoke");
    Token token = new BearerAccessToken();
    ClientAuthentication clientAuth = new ClientSecretBasic(new ClientID("123"), new Secret("secret"));

    TokenRevocationRequest request = new TokenRevocationRequest(endpointURI, clientAuth, token);
    assertEquals(endpointURI, request.getEndpointURI());
    assertEquals(clientAuth, request.getClientAuthentication());
    assertEquals(token, request.getToken());
View Full Code Here

TOP

Related Classes of com.nimbusds.oauth2.sdk.AuthorizationGrantTest

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.