private Authenticator getAuthenticator() throws AuthenticationException { Authenticator authenticator = authenticatorInstance.isUnsatisfied() ? idmAuthenticatorInstance.get() : authenticatorInstance.get(); if (authenticator == null) { throw new AuthenticationException("No Authenticator has been configured."); } return authenticator; }
response.getWriter().append(e.getMessage()); e.printStackTrace();
/** * <p>Writes the <code>issuedToken</code> to the {@link javax.servlet.http.HttpServletResponse}.</p> * * @param issuedToken * @param request * @param response */ protected void writeToken(String issuedToken, HttpServletRequest request, HttpServletResponse response) { try { response.setStatus(HttpServletResponse.SC_OK); PrintWriter writer = response.getWriter(); writer.print("{\"authctoken\":\"" + issuedToken + "\"}"); writer.flush(); } catch (Exception e) { throw new AuthenticationException("Could not write token to response.", e); } }
private Authenticator getAuthenticator() throws AuthenticationException { Authenticator authenticator = authenticatorInstance.isUnsatisfied() ? idmAuthenticatorInstance.get() : authenticatorInstance.get(); if (authenticator == null) { throw new AuthenticationException("No Authenticator has been configured."); } return authenticator; }
/** * <p>Writes the <code>issuedToken</code> to the {@link javax.servlet.http.HttpServletResponse}.</p> * * @param issuedToken * @param request * @param response */ protected void writeToken(String issuedToken, HttpServletRequest request, HttpServletResponse response) { try { response.setStatus(HttpServletResponse.SC_OK); PrintWriter writer = response.getWriter(); writer.print("{\"authctoken\":\"" + issuedToken + "\"}"); writer.flush(); } catch (Exception e) { throw new AuthenticationException("Could not write token to response.", e); } }
/** * <p>Writes the <code>issuedToken</code> to the {@link javax.servlet.http.HttpServletResponse}.</p> * * @param issuedToken * @param request * @param response */ protected void writeToken(String issuedToken, HttpServletRequest request, HttpServletResponse response) { try { response.setStatus(HttpServletResponse.SC_OK); PrintWriter writer = response.getWriter(); writer.print("{\"authctoken\":\"" + issuedToken + "\"}"); writer.flush(); } catch (Exception e) { throw new AuthenticationException("Could not write token to response.", e); } }
private Authenticator getAuthenticator() throws AuthenticationException { Authenticator authenticator = authenticatorInstance.isUnsatisfied() ? idmAuthenticatorInstance.get() : authenticatorInstance.get(); if (authenticator == null) { throw new AuthenticationException("No Authenticator has been configured."); } return authenticator; }
protected Consumer getTokenConsumer() { if (this.tokenConsumer.isAmbiguous()) { throw new AuthenticationException("You must provide exactly one " + Consumer.class.getName() + " implementation."); } if (!this.tokenConsumer.isUnsatisfied()) { return this.tokenConsumer.get(); } return null; }
protected Provider getTokenProvider() { if (this.tokenProvider.isAmbiguous()) { throw new AuthenticationException("You must provide exactly one " + Provider.class.getName() + " implementation."); } if (!this.tokenProvider.isUnsatisfied()) { return this.tokenProvider.get(); } return null; }
protected Provider getTokenProvider() { if (this.tokenProvider.isAmbiguous()) { throw new AuthenticationException("You must provide exactly one " + Provider.class.getName() + " implementation."); } if (!this.tokenProvider.isUnsatisfied()) { return this.tokenProvider.get(); } return null; }
protected Consumer getTokenConsumer() { if (this.tokenConsumer.isAmbiguous()) { throw new AuthenticationException("You must provide exactly one " + Consumer.class.getName() + " implementation."); } if (!this.tokenConsumer.isUnsatisfied()) { return this.tokenConsumer.get(); } return null; }
protected Provider getTokenProvider() { if (this.tokenProvider.isAmbiguous()) { throw new AuthenticationException("You must provide exactly one " + Provider.class.getName() + " implementation."); } if (!this.tokenProvider.isUnsatisfied()) { return this.tokenProvider.get(); } return null; }
protected Consumer getTokenConsumer() { if (this.tokenConsumer.isAmbiguous()) { throw new AuthenticationException("You must provide exactly one " + Consumer.class.getName() + " implementation."); } if (!this.tokenConsumer.isUnsatisfied()) { return this.tokenConsumer.get(); } return null; }
/** * <p>Issues a token for a previously authenticated {@link org.picketlink.idm.model.Account} using the * configured {@link org.picketlink.idm.credential.Token.Provider}.</p> * * @param request * @param response */ protected String issueToken(HttpServletRequest request, HttpServletResponse response) { Provider tokenProvider = getTokenProvider(); if (tokenProvider == null) { throw new AuthenticationException("No " + Provider.class.getName() + " was found."); } return tokenProvider.issue(getIdentity().getAccount()).getToken(); }
/** * <p>Issues a token for a previously authenticated {@link org.picketlink.idm.model.Account} using the * configured {@link org.picketlink.idm.credential.Token.Provider}.</p> * * @param request * @param response */ protected String issueToken(HttpServletRequest request, HttpServletResponse response) { Provider tokenProvider = getTokenProvider(); if (tokenProvider == null) { throw new AuthenticationException("No " + Provider.class.getName() + " was found."); } return tokenProvider.issue(getIdentity().getAccount()).getToken(); }
/** * <p>Issues a token for a previously authenticated {@link org.picketlink.idm.model.Account} using the * configured {@link org.picketlink.idm.credential.Token.Provider}.</p> * * @param request * @param response */ protected String issueToken(HttpServletRequest request, HttpServletResponse response) { Provider tokenProvider = getTokenProvider(); if (tokenProvider == null) { throw new AuthenticationException("No " + Provider.class.getName() + " was found."); } return tokenProvider.issue(getIdentity().getAccount()).getToken(); }
session.removeAttribute("requestToken"); } catch (TwitterException e) { throw new AuthenticationException("Twitter Login:",e); return; } catch (TwitterException e) { throw new AuthenticationException("Twitter Login:",e); throw new AuthenticationException("Twitter Login:", e);
throw new AuthenticationException("No Authenticator has been configured."); throw new AuthenticationException("Authenticator must return a valid authentication status"); throw new AuthenticationException("Authentication failed.", ex);
/** * <p>Creates a {@link org.picketlink.idm.credential.TokenCredential} using the token previously extracted from the request.</p> * * <p>Subclasses can override this method to customize how the credential is created. Defaults to an instance of {@link org.picketlink.idm.credential.TokenCredential}.</p> * * @param extractedToken The token previously extracted from the request. * @return */ protected TokenCredential createCredential(String extractedToken) { Token token; Provider tokenProvider = getTokenProvider(); if (tokenProvider != null) { token = create(getTokenProvider().getTokenType().getName(), extractedToken); } else { Consumer tokenConsumer = getTokenConsumer(); if (tokenConsumer == null) { throw new AuthenticationException("You must provide a " + Provider.class.getName() + " or " + Consumer.class.getName() + "."); } token = create(getTokenConsumer().getTokenType().getName(), extractedToken); } return new TokenCredential(token); }
/** * <p>Creates a {@link org.picketlink.idm.credential.TokenCredential} using the token previously extracted from the request.</p> * * <p>Subclasses can override this method to customize how the credential is created. Defaults to an instance of {@link org.picketlink.idm.credential.TokenCredential}.</p> * * @param extractedToken The token previously extracted from the request. * @return */ protected TokenCredential createCredential(String extractedToken) { Token token; Provider tokenProvider = getTokenProvider(); if (tokenProvider != null) { token = create(getTokenProvider().getTokenType().getName(), extractedToken); } else { Consumer tokenConsumer = getTokenConsumer(); if (tokenConsumer == null) { throw new AuthenticationException("You must provide a " + Provider.class.getName() + " or " + Consumer.class.getName() + "."); } token = create(getTokenConsumer().getTokenType().getName(), extractedToken); } return new TokenCredential(token); }