Examples of UnsupportedGrantTypeException


Examples of org.springframework.security.oauth2.common.exceptions.UnsupportedGrantTypeException

      tokenRequest.setScope(OAuth2Utils.parseParameterList(parameters.get(OAuth2Utils.SCOPE)));
    }

    OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
    if (token == null) {
      throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
    }

    return getResponse(token);

  }
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.UnsupportedGrantTypeException

    assertEquals(expected, getOutput());
  }

  @Test
  public void writeUnsupportedGrantType() throws Exception {
    OAuth2Exception oauthException = new UnsupportedGrantTypeException(DETAILS);
    String expected = createResponse(oauthException.getOAuth2ErrorCode());
    converter.write(oauthException, contentType, outputMessage);
    assertEquals(expected, getOutput());
  }
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.UnsupportedGrantTypeException

  @Test
  public void readUnsupportedGrantType() throws Exception {
    String accessToken = createResponse(OAuth2Exception.UNSUPPORTED_GRANT_TYPE);
    when(inputMessage.getBody()).thenReturn(createInputStream(accessToken));
    @SuppressWarnings("unused")
    UnsupportedGrantTypeException result = (UnsupportedGrantTypeException) converter.read(OAuth2Exception.class, inputMessage);
  }
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.UnsupportedGrantTypeException

  }

  @Test
  public void readValueUnsupportedGrantType() throws Exception {
    String accessToken = createResponse(OAuth2Exception.UNSUPPORTED_GRANT_TYPE);
    UnsupportedGrantTypeException result = (UnsupportedGrantTypeException) mapper.readValue(accessToken,
        OAuth2Exception.class);
    assertEquals(DETAILS,result.getMessage());
    assertEquals(null,result.getAdditionalInformation());
  }
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.UnsupportedGrantTypeException

    assertEquals(expected,mapper.writeValueAsString(oauthException));
  }

  @Test
  public void writeValueAsStringUnsupportedGrantType() throws Exception {
    oauthException = new UnsupportedGrantTypeException(DETAILS);
    String expected = createResponse(oauthException.getOAuth2ErrorCode());
    assertEquals(expected,mapper.writeValueAsString(oauthException));
  }
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.UnsupportedGrantTypeException

  }

  @Test
  public void readValueUnsupportedGrantType() throws Exception {
    String accessToken = createResponse(OAuth2Exception.UNSUPPORTED_GRANT_TYPE);
    UnsupportedGrantTypeException result = (UnsupportedGrantTypeException) mapper.readValue(accessToken,
        OAuth2Exception.class);
    assertEquals(DETAILS,result.getMessage());
    assertEquals(null,result.getAdditionalInformation());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.