Package com.nimbusds.oauth2.sdk

Examples of com.nimbusds.oauth2.sdk.ErrorObject


   */
  public static void ensureContentType(final ContentType expected, final ContentType found)
    throws ParseException {
 
    if (found == null)
      throw new ParseException("Missing HTTP Content-Type header");
   
    if (! expected.match(found))
      throw new ParseException("The HTTP Content-Type header must be " + expected);
  }
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

    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


  public void testResolveSimple()
    throws Exception {

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

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

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

 
 
  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

  @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

TOP

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

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.