Package com.nimbusds.oauth2.sdk

Examples of com.nimbusds.oauth2.sdk.Scope


        }
      }
    }


    Scope scope = null;

    m = scopePattern.matcher(wwwAuth);

    if (m.find())
      scope = Scope.parse(m.group(1));
View Full Code Here



  public void testFullConstructor()
    throws Exception {
   
    Scope scope = Scope.parse("read write");

    AccessToken token = new BearerAccessToken("abc", 1500, scope);
   
    assertEquals("abc", token.getValue());
    assertEquals(1500l, token.getLifetime());
View Full Code Here

      op.endSessionEndpoint = JSONObjectUtils.getURI(jsonObject, "end_session_endpoint");

    // OIDC capabilities
    if (jsonObject.containsKey("scopes_supported")) {

      op.scope = new Scope();

      for (String v: JSONObjectUtils.getStringArray(jsonObject, "scopes_supported")) {

        if (v != null)
          op.scope.add(new Scope.Value(v));
View Full Code Here

    Set<URI> redirectURIs = new HashSet<>();
    redirectURIs.add(new URI("http://example.com/1"));
    redirectURIs.add(new URI("http://example.com/2"));
    meta.setRedirectionURIs(redirectURIs);
   
    Scope scope = Scope.parse("read write");
    meta.setScope(scope);
   
    Set<ResponseType> rts = new HashSet<>();
    rts.add(ResponseType.parse("code id_token"));
    meta.setResponseTypes(rts);
View Full Code Here

                   OAuth2Error.UNSUPPORTED_RESPONSE_TYPE,
                   clientID, redirectURI, state);
    }
   
    // Required in OIDC, must include "openid" parameter
    Scope scope = ar.getScope();

    if (scope == null)
      throw new ParseException("Missing \"scope\" parameter",
                         OAuth2Error.INVALID_REQUEST,
                   clientID, redirectURI, state);

    if (! scope.contains(OIDCScopeValue.OPENID))
      throw new ParseException("The scope must include an \"openid\" token",
                         OAuth2Error.INVALID_REQUEST,
                   clientID, redirectURI, state);

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.Scope

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.