private static OAuth2HandlerError getError(final String contextMessage, final Exception e) { return new OAuth2HandlerError(MacTokenHandler.ERROR, contextMessage, e); } }
private static OAuth2HandlerError getError(final String contextMessage, final Exception e) { return new OAuth2HandlerError(BasicAuthenticationHandler.ERROR, contextMessage, e); } }
public OAuth2HandlerError handleResponse(final OAuth2Accessor accessor, final HttpResponse response) { return new OAuth2HandlerError(OAuth2Error.AUTHORIZATION_CODE_PROBLEM, "doesn't handle responses", null); }
private static OAuth2HandlerError getError(final String contextMessage, final Exception e, final String uri, final String description) { return new OAuth2HandlerError(TokenAuthorizationResponseHandler.ERROR, contextMessage, e, uri, description); } }
private static OAuth2HandlerError getError(final String contextMessage, final Exception e) { return new OAuth2HandlerError(BearerTokenHandler.ERROR, contextMessage, e, "", ""); } }
private static OAuth2HandlerError getError(final String contextMessage, final Exception e) { return new OAuth2HandlerError(StandardAuthenticationHandler.ERROR, contextMessage, e); } }
ret = new OAuth2HandlerError(OAuth2Error.AUTHORIZATION_CODE_PROBLEM, "accessor is null", null); } else if (request == null) { ret = new OAuth2HandlerError(OAuth2Error.AUTHORIZATION_CODE_PROBLEM, "request is null", null); } else if (!accessor.isValid() || accessor.isErrorResponse() || !accessor.isRedirecting()) { ret = new OAuth2HandlerError(OAuth2Error.AUTHORIZATION_CODE_PROBLEM, "accessor is invalid", null); } else if (!accessor.getGrantType().equalsIgnoreCase(OAuth2Message.AUTHORIZATION)) { ret = new OAuth2HandlerError(OAuth2Error.AUTHORIZATION_CODE_PROBLEM, "grant_type is not code", null); msg.parseRequest(request); if (msg.getError() != null) { ret = new OAuth2HandlerError(msg.getError(), "error parsing authorization response", null, msg.getErrorUri(), msg.getErrorDescription()); } else { "Exception exchanging authorization code for access_token", e); ret = new OAuth2HandlerError(OAuth2Error.AUTHORIZATION_CODE_PROBLEM, "Exception exchanging authorization code for access_token", e);
@Test public void testGetContextMessage1() throws Exception { final OAuth2HandlerError fixture = new OAuth2HandlerError(OAuth2Error.AUTHENTICATION_PROBLEM, "", new Exception()); final String result = fixture.getContextMessage(); Assert.assertEquals("", result); }
@Test public void testToString1() throws Exception { final OAuth2HandlerError fixture = new OAuth2HandlerError(OAuth2Error.AUTHENTICATION_PROBLEM, "", new Exception()); final String result = fixture.toString(); Assert.assertEquals( "org.apache.shindig.gadgets.oauth2.handler.OAuth2HandlerError : AUTHENTICATION_PROBLEM : : : :java.lang.Exception", result); } }
@Test public void testToString1() throws Exception { final OAuth2HandlerError fixture = new OAuth2HandlerError(OAuth2Error.AUTHENTICATION_PROBLEM, "", new Exception()); final String result = fixture.toString(); Assert.assertEquals( "org.apache.shindig.gadgets.oauth2.handler.OAuth2HandlerError : AUTHENTICATION_PROBLEM : : : :java.lang.Exception", result); } }
@Test public void testGetContextMessage1() throws Exception { final OAuth2HandlerError fixture = new OAuth2HandlerError(OAuth2Error.AUTHENTICATION_PROBLEM, "", new Exception()); final String result = fixture.getContextMessage(); Assert.assertEquals("", result); }
@Test public void testGetCause1() throws Exception { final OAuth2HandlerError fixture = new OAuth2HandlerError(OAuth2Error.AUTHENTICATION_PROBLEM, "", new Exception()); final Exception result = fixture.getCause(); Assert.assertNotNull(result); Assert.assertEquals(null, result.getMessage()); Assert.assertEquals(null, result.getLocalizedMessage()); Assert.assertEquals("java.lang.Exception", result.toString()); Assert.assertEquals(null, result.getCause()); }
@Test public void testGetCause1() throws Exception { final OAuth2HandlerError fixture = new OAuth2HandlerError(OAuth2Error.AUTHENTICATION_PROBLEM, "", new Exception()); final Exception result = fixture.getCause(); Assert.assertNotNull(result); Assert.assertEquals(null, result.getMessage()); Assert.assertEquals(null, result.getLocalizedMessage()); Assert.assertEquals("java.lang.Exception", result.toString()); Assert.assertEquals(null, result.getCause()); }
@Test public void testOAuth2HandlerError1() throws Exception { final OAuth2Error error = OAuth2Error.AUTHENTICATION_PROBLEM; final String contextMessage = ""; final Exception cause = new Exception(); final OAuth2HandlerError result = new OAuth2HandlerError(error, contextMessage, cause); Assert.assertNotNull(result); Assert.assertEquals("", result.getContextMessage()); Assert.assertEquals( "org.apache.shindig.gadgets.oauth2.handler.OAuth2HandlerError : AUTHENTICATION_PROBLEM : : : :java.lang.Exception", result.toString()); }
@Test public void testOAuth2HandlerError1() throws Exception { final OAuth2Error error = OAuth2Error.AUTHENTICATION_PROBLEM; final String contextMessage = ""; final Exception cause = new Exception(); final OAuth2HandlerError result = new OAuth2HandlerError(error, contextMessage, cause); Assert.assertNotNull(result); Assert.assertEquals("", result.getContextMessage()); Assert.assertEquals( "org.apache.shindig.gadgets.oauth2.handler.OAuth2HandlerError : AUTHENTICATION_PROBLEM : : : :java.lang.Exception", result.toString()); }
BasicOAuth2Request.LOG.log("refreshToken()", e); ret = new OAuth2HandlerError(OAuth2Error.REFRESH_TOKEN_PROBLEM, "error generating refresh body", e); ret = new OAuth2HandlerError(OAuth2Error.REFRESH_TOKEN_PROBLEM, "error fetching refresh token - domain not allowed", null); BasicOAuth2Request.LOG.log("refreshToken()", e); ret = new OAuth2HandlerError(OAuth2Error.REFRESH_TOKEN_PROBLEM, "error fetching refresh token", e); ret = new OAuth2HandlerError(OAuth2Error.REFRESH_TOKEN_PROBLEM, "response is null", null); this.store.removeToken(accessor.getRefreshToken()); } catch (final GadgetException e) { ret = new OAuth2HandlerError(OAuth2Error.REFRESH_TOKEN_PROBLEM, "failed to remove refresh token", e); ret = new OAuth2HandlerError(OAuth2Error.REFRESH_TOKEN_PROBLEM, "bad response from server : " + statusCode, null, "", response.getResponseAsString()); this.store.removeToken(accessor.getRefreshToken()); } catch (final GadgetException e) { ret = new OAuth2HandlerError(OAuth2Error.REFRESH_TOKEN_PROBLEM, error.getContextMessage(), e, error.getUri(), error.getDescription());
@Test public void testGetError1() throws Exception { final OAuth2HandlerError fixture = new OAuth2HandlerError(OAuth2Error.AUTHENTICATION_PROBLEM, "", new Exception()); final OAuth2Error result = fixture.getError(); Assert.assertNotNull(result); Assert.assertEquals("authentication_problem", result.getErrorCode()); Assert.assertEquals("AUTHENTICATION_PROBLEM", result.name()); Assert.assertEquals(2, result.ordinal()); Assert.assertEquals("AUTHENTICATION_PROBLEM", result.toString()); }
@Test public void testGetError1() throws Exception { final OAuth2HandlerError fixture = new OAuth2HandlerError(OAuth2Error.AUTHENTICATION_PROBLEM, "", new Exception()); final OAuth2Error result = fixture.getError(); Assert.assertNotNull(result); Assert.assertEquals("authentication_problem", result.getErrorCode()); Assert.assertEquals("AUTHENTICATION_PROBLEM", result.name()); Assert.assertEquals(2, result.ordinal()); Assert.assertEquals("AUTHENTICATION_PROBLEM", result.toString()); }
ret = new OAuth2HandlerError(OAuth2Error.AUTHORIZATION_CODE_PROBLEM, "Exception exchanging authorization code for access_token - domain not allowed", null); "UnsupportedEncodingException getting authorization body", e); ret = new OAuth2HandlerError(OAuth2Error.AUTHORIZATION_CODE_PROBLEM, "error getting authorization body", e); CodeAuthorizationResponseHandler.LOG.log("error exchanging code for access_token", e); ret = new OAuth2HandlerError(OAuth2Error.AUTHORIZATION_CODE_PROBLEM, "error exchanging code for access_token", e); msg.parseJSON(response.getResponseAsString()); if (msg.getError() != null) { ret = new OAuth2HandlerError(msg.getError(), "error exchanging code for access_token", null, msg.getErrorUri(), msg.getErrorDescription());
} catch (final OAuth2RequestException e) { authorizationRequest = null; ret = new OAuth2HandlerError(e.getError(), e.getErrorText(), e); ret = new OAuth2HandlerError(OAuth2Error.AUTHORIZE_PROBLEM, "exception thrown fetching authorization", e);