Exemplo n.º 1
0
 @Override
 protected boolean hasBeenCancelled(final WebContext context) {
   final String error = context.getRequestParameter(OAuthCredentialsException.ERROR);
   final String errorReason = context.getRequestParameter(OAuthCredentialsException.ERROR_REASON);
   // user has denied permissions
   if ("access_denied".equals(error) && "user_denied".equals(errorReason)) {
     return true;
   } else {
     return false;
   }
 }
Exemplo n.º 2
0
 @Override
 protected boolean hasBeenCancelled(final WebContext context) {
   final String error = context.getRequestParameter(OAuthCredentialsException.ERROR);
   final String errorDescription =
       context.getRequestParameter(OAuthCredentialsException.ERROR_DESCRIPTION);
   // user has denied permissions
   if ("access_denied".equals(error) && "the+user+denied+your+request".equals(errorDescription)) {
     return true;
   } else {
     return false;
   }
 }
Exemplo n.º 3
0
  /**
   * Get the credentials from the web context.
   *
   * @param context the web context
   * @return the credentials
   * @throws RequiresHttpAction requires an extra HTTP action
   */
  @Override
  protected CasCredentials retrieveCredentials(final WebContext context) throws RequiresHttpAction {

    // like the SingleSignOutFilter from CAS client :
    if (this.logoutHandler.isTokenRequest(context)) {
      final String ticket = context.getRequestParameter(SERVICE_TICKET_PARAMETER);
      this.logoutHandler.recordSession(context, ticket);
      final CasCredentials casCredentials = new CasCredentials(ticket, getName());
      logger.debug("casCredentials : {}", casCredentials);
      return casCredentials;
    }

    if (this.logoutHandler.isLogoutRequest(context)) {
      this.logoutHandler.destroySession(context);
      final String message = "logout request : no credential returned";
      logger.debug(message);
      throw RequiresHttpAction.ok(message, context);
    }

    if (this.gateway) {
      logger.info("No credential found in this gateway round-trip");
      return null;
    }
    final String message = "No ticket or logout request";
    throw new CredentialsException(message);
  }
Exemplo n.º 4
0
 @Override
 protected boolean hasBeenCancelled(final WebContext context) {
   final String denied = context.getRequestParameter("denied");
   if (CommonHelper.isNotBlank(denied)) {
     return true;
   } else {
     return false;
   }
 }