Examples of AuthenticationException


Examples of br.gov.frameworkdemoiselle.security.AuthenticationException

  public Principal getUser() {
    throw getException();
  }

  private DemoiselleException getException() {
    return new AuthenticationException(getBundle().getString("authenticator-not-defined",
        SecurityContext.class.getSimpleName()), new ClassNotFoundException());
  }
View Full Code Here

Examples of ch.rolandschaer.ascrblr.util.AuthenticationException

        case HttpURLConnection.HTTP_BAD_GATEWAY:
            throw new ResourceNotFoundException(httpConn);

        case HttpURLConnection.HTTP_FORBIDDEN:
            throw new AuthenticationException(httpConn);

        default:
            throw new ServiceException(httpConn);
        }
View Full Code Here

Examples of com.cloudloop.adapter.exceptions.AuthenticationException

  {
      loggedin = _client.login( );
  }
  catch ( IOException e )
  {
      throw new AuthenticationException( e );
  }
  if ( !loggedin )
  {
      throw new AuthenticationException(
        "Could not login to rackspace cloudstore" );
  }
  // Check if the root container exists
  try
  {
View Full Code Here

Examples of com.codeborne.security.AuthenticationException

              messagingMode, 0, false, false, sessCode, result,
              personalCodeHolder, firstName, lastName, new StringHolder(), new StringHolder(), new StringHolder(), challenge,
              new StringHolder(), new StringHolder());
    }
    catch (RemoteException e) {
      throw new AuthenticationException(e);
    }

    if (!"OK".equals(result.value))
      throw new AuthenticationException(valueOf(result.value));

    return new MobileIDSession(sessCode.value, challenge.value, firstName.value, lastName.value, personalCodeHolder.value);
  }
View Full Code Here

Examples of com.comcast.cmb.common.util.AuthenticationException

          }
        }
       
        if (accessKey == null) {
            logger.error("event=authenticate error_code=missing_access_key");
            throw new AuthenticationException(CMBErrorCodes.InvalidAccessKeyId, "No access key provided");  
        }
       
        User user = null;
       
        try {

          try {
                user = userCacheByAccessKey.getAndSetIfNotPresent(accessKey, new UserCallableByAccessKey(accessKey), CMBProperties.getInstance().getUserCacheExpiring() * 1000);
            } catch (CacheFullException e) {
                user = new UserCallableByAccessKey(accessKey).call();
            }
           
            if (user == null) {
                logger.error("event=authenticate access_key=" + accessKey + " error_code=invalid_accesskey");
                throw new AuthenticationException(CMBErrorCodes.InvalidAccessKeyId, "AccessKey " + accessKey + " is not valid");
            }
           
        } catch (Exception ex) {
            logger.error("event=authenticate", ex);
            throw new AuthenticationException(CMBErrorCodes.InvalidAccessKeyId, "AccessKey " + accessKey + " is not valid");
        }
       
        // admin actions do not require signatures but can only be performed by admin user
       
        if (ADMIN_ACTIONS.contains(parameters.get("Action"))) {
          if (CMBProperties.getInstance().getCNSUserName().equals(user.getUserName())) {
                logger.debug("event=authenticate action=admin_action");
            return user;
          } else {
                logger.error("event=authenticate error_code=regular_user_attempted_admin_op");
            throw new AuthenticationException(CMBErrorCodes.InvalidAccessKeyId, "User not authorized to perform admin actions");
          }
        }

        if ((!CMBProperties.getInstance().getEnableSignatureAuth())||
            (request.getMethod().equals("GET")&&CMBProperties.getInstance().getAllowGetRequest())) {
            if (!user.getUserName().equals(CMBProperties.getInstance().getCNSUserName())) {
              logger.debug("event=authenticate verify_signature=not_required");
            }
            return user;
        }
       
        //version 1 and 2 is from parameters
        String version = parameters.get("SignatureVersion");
        //version 4 is recommended from header
        if((version == null)&&(authorizationHeader != null)){
          if(authorizationHeader.trim().startsWith("AWS4")){
            version="4";
          }
        }
       
        if (!version.equals("1") && !version.equals("2")&&!version.equals("4")) {
          logger.error("event=authenticate signature_version="+version+" error_code=unsupported_signature_version");
            throw new AuthenticationException(CMBErrorCodes.NoSuchVersion, "SignatureVersion="+version+" is not valid");
        }
       
        //validate signature for version 1 and 2
        if (version.equals("1")||version.equals("2")){
          String signatureToCheck = parameters.get("Signature");
         
          if (signatureToCheck == null) {
              logger.error("event=authenticate error_code=no_signature_provided");
              throw new AuthenticationException(CMBErrorCodes.MissingParameter, "Signature not found");
          }
 
          String timeStamp = parameters.get("Timestamp");
          String expiration = parameters.get("Expires");
         
          if (timeStamp != null) {
              AuthUtil.checkTimeStamp(timeStamp);
          } else if (expiration != null) {
              AuthUtil.checkExpiration(expiration);
          } else {
              logger.error("event=authenticate error_code=no_time_stamp_or_expiration");
              throw new AuthenticationException(CMBErrorCodes.MissingParameter, "Request must provide either Timestamp or Expires parameter");
          }
 
          String signatureMethod = parameters.get("SignatureMethod");
         
          if (!signatureMethod.equals("HmacSHA256") && !signatureMethod.equals("HmacSHA1")) { 
              logger.error("event=authenticate signature_method=" + signatureMethod + " error_code=unsupported_signature_method");
              throw new AuthenticationException(CMBErrorCodes.InvalidParameterValue, "Signature method " + signatureMethod + " is not supported");
          }
        
          URL url = null;
          String signature = null;
         
          try {
              url = new URL(request.getRequestURL().toString());
              parameters.remove("Signature");
            signature = AuthUtil.generateSignature(url, parameters, version, signatureMethod, user.getAccessSecret());
          } catch (Exception ex) {
              logger.error("event=authenticate url="+url+" error_code=invalid_url");
              throw new AuthenticationException(CMBErrorCodes.InternalError, "Invalid Url " + url);
          }
 
          if (signature == null || !signature.equals(signatureToCheck)) {
              logger.error("event=authenticate signature_calculated=" + signature + " signature_given=" + signatureToCheck + " error_code=signature_mismatch");
              throw new AuthenticationException(CMBErrorCodes.InvalidSignature, "Invalid signature");
          }
        }
       
        //validate signature for version 4
        if (version.equals("4")){
          //get the signature from head
           String signatureToCheck = authorizationHeader.substring(authorizationHeader.indexOf("Signature=") + "Signature=".length());
         
          if (signatureToCheck == null) {
              logger.error("event=authenticate error_code=no_signature_provided");
              throw new AuthenticationException(CMBErrorCodes.MissingParameter, "Signature not found");
          }
         
          String timeStamp = request.getHeader("X-Amz-Date");
         
          if (timeStamp != null) {
              AuthUtil.checkTimeStampV4(timeStamp);
          } else {
              logger.error("event=authenticate error_code=no_time_stamp_or_expiration");
              throw new AuthenticationException(CMBErrorCodes.MissingParameter, "Request must provide either Timestamp or Expires parameter");
          }
 
          String signatureMethod = authorizationHeader.substring("AWS4-".length(), authorizationHeader.indexOf("Credential=")).trim();
          //currently support HMAC-SHA256
          if (!signatureMethod.equals("HMAC-SHA256")) { 
              logger.error("event=authenticate signature_method=" + signatureMethod + " error_code=unsupported_signature_method");
              throw new AuthenticationException(CMBErrorCodes.InvalidParameterValue, "Signature method " + signatureMethod + " is not supported");
          }
        
          URL url = null;
          String signature = null;
         
          try {
            String urlOriginal=request.getRequestURL().toString();
            if(urlOriginal==null || urlOriginal.length()==0){
              urlOriginal="/";
            }
              url = new URL(urlOriginal);
              signature = AuthUtil.generateSignatureV4(request, url, parameters, headers, version, signatureMethod, user.getAccessSecret());
          } catch (Exception ex) {
              logger.error("event=authenticate url="+url+" error_code=invalid_url");
              throw new AuthenticationException(CMBErrorCodes.InternalError, "Invalid Url " + url);
          }
 
          if (signature == null || !signature.equals(signatureToCheck)) {
              logger.error("event=authenticate signature_calculated=" + signature + " signature_given=" + signatureToCheck + " error_code=signature_mismatch");
              throw new AuthenticationException(CMBErrorCodes.InvalidSignature, "Invalid signature");
          }
        }
        logger.debug("event=authenticated_by_signature username=" + user.getUserName());

        return user;
View Full Code Here

Examples of com.company.client.domain.AuthenticationException

  /**
   * {@inheritDoc}
   */
  public void login(String userName) throws AuthenticationException {
    if (userName.equals("badguy")) {
      throw new AuthenticationException();
    }
    authentication = new Authentication(userName);
  }
View Full Code Here

Examples of com.cosmo.security.auth.AuthenticationException

         int statusCode = httpClient.executeMethod(method);
        
         if (statusCode != HttpStatus.SC_OK)
         {
            method.releaseConnection();
            throw new AuthenticationException("El servidor de CAS no ha respondido correctamente a la llamada de validaci�n de la autenticaci�n (CAS ticket=" + serviceTicket + ").");
         }
         else
        
            String resp = new String(method.getResponseBody());           
            user = getUserDataFromValidation(resp);

            // result = extractUser(new String(method.getResponseBody()));
         }
      }
      catch (IOException ex)
      {
         throw new AuthenticationException(ex.getMessage(), ex);
      }
      catch (AuthenticationException ex)
      {
         throw ex;
      }
View Full Code Here

Examples of com.datastax.driver.core.exceptions.AuthenticationException

        Message.Response authResponse = write(creds).get();
        switch (authResponse.type) {
            case READY:
                break;
            case ERROR:
                throw defunct(new AuthenticationException(address, ((Responses.Error)authResponse).message));
            default:
                throw defunct(new TransportException(address, String.format("Unexpected %s response message from server to a CREDENTIALS message", authResponse.type)));
        }
    }
View Full Code Here

Examples of com.datastax.driver.core.exceptions.AuthenticationException

                // initial AuthResponse message
                String message = ((Responses.Error)authResponse).message;
                if (message.startsWith("java.lang.ArrayIndexOutOfBoundsException: 15"))
                    message = String.format("Cannot use authenticator %s with protocol version 1, "
                                  + "only plain text authentication is supported with this protocol version", authenticator);
                throw defunct(new AuthenticationException(address, message));
            default:
                throw defunct(new TransportException(address, String.format("Unexpected %s response message from server to authentication message", authResponse.type)));
        }
    }
View Full Code Here

Examples of com.elasticinbox.core.account.authenticator.AuthenticationException

      // authenticate mailbox, if failed return null
      AccountStatus status = validator.getAccountStatus(username);
      session.getLogger().debug("Validated account (" + username + ") status is " + status.toString());
 
      if (!status.equals(AccountStatus.ACTIVE)) {
        throw new AuthenticationException("User " + username + " does not exist or inactive");
      }
 
      // authenticate user with password
      mailbox = authenticator.authenticate(username, password);
 
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.