public void setError(OAuth2Error error) { this.params.put(OAuth2Message.ERROR, error.getErrorCode()); }
errorResponse = String.format(OAuth2CallbackServlet.RESP_ERROR_BODY, error.getErrorCode(), error.getErrorDescription(description), uri); } else { errorResponse = String.format(OAuth2CallbackServlet.RESP_ERROR_BODY, error.getErrorCode(), "", "");
@Test public void testGetErrorCode_1() throws Exception { final OAuth2Error fixture = OAuth2Error.AUTHENTICATION_PROBLEM; final String result = fixture.getErrorCode(); Assert.assertEquals("authentication_problem", result); }
@Test public void testGetErrorCode_1() throws Exception { final OAuth2Error fixture = OAuth2Error.AUTHENTICATION_PROBLEM; final String result = fixture.getErrorCode(); Assert.assertEquals("authentication_problem", result); }
private HttpResponseBuilder getErrorResponseBuilder(final Throwable t, final OAuth2Error error, final String contextMessage, final String errorUri, final String errorDescription) { final boolean isLogging = BasicOAuth2Request.LOG.isLoggable(); if (isLogging) { BasicOAuth2Request.LOG.entering(BasicOAuth2Request.LOG_CLASS, "getErrorResponseBuilder", new Object[] { t, error, contextMessage, errorUri, errorDescription }); } final HttpResponseBuilder ret = new HttpResponseBuilder().setHttpStatusCode( HttpResponse.SC_FORBIDDEN).setStrictNoCache(); if (t != null && this.sendTraceToClient) { final StringWriter sw = new StringWriter(); t.printStackTrace(new PrintWriter(sw)); final String message = sw.toString(); this.responseParams.addDebug(message); } if (this.sendTraceToClient) { this.responseParams.addToResponse(ret, error.getErrorCode(), error.getErrorDescription(contextMessage) + " , " + errorDescription, errorUri, error.getErrorExplanation()); } else { this.responseParams.addToResponse(ret, error.getErrorCode(), "", "", error.getErrorExplanation()); } if (isLogging) { BasicOAuth2Request.LOG.exiting(BasicOAuth2Request.LOG_CLASS, "getErrorResponseBuilder", ret); } return ret; }
@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 testGetError_1() throws Exception { final OAuth2RequestException fixture = new OAuth2RequestException( OAuth2Error.AUTHENTICATION_PROBLEM, "", new Throwable()); 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()); }
@Test public void testGetError_1() throws Exception { final OAuth2RequestException fixture = new OAuth2RequestException( OAuth2Error.AUTHENTICATION_PROBLEM, "", new Throwable()); 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()); }