Package com.cloud.bridge.persist.dao

Examples of com.cloud.bridge.persist.dao.UserCredentialsDao


            //System.out.println( "cert: " + userCert.toString());             
            String uniqueId = AuthenticationUtils.X509CertUniqueId( userCert );
            logger.debug( "X509 cert's uniqueId: " + uniqueId );

            // -> find the Cloud API key and the secret key from the cert's uniqueId
            UserCredentialsDao ucDao = new UserCredentialsDaoImpl();
            UserCredentialsVO cloudKeys = ucDao.getByCertUniqueId(uniqueId);
            if ( null == cloudKeys ) {
                logger.error( "Cert does not map to Cloud API keys: " + uniqueId );
                throw new AxisFault( "User not properly registered: Certificate does not map to Cloud API Keys", "Client.Blocked" );
            }
            else UserContext.current().initContext( cloudKeys.getAccessKey(), cloudKeys.getSecretKey(), cloudKeys.getAccessKey(), "SOAP Request", null );
View Full Code Here


                //System.out.println( "cert: " + userCert.toString());
                String uniqueId = AuthenticationUtils.X509CertUniqueId(userCert);
                logger.debug("X509 cert's uniqueId: " + uniqueId);

                // -> find the Cloud API key and the secret key from the cert's uniqueId
                UserCredentialsDao ucDao = new UserCredentialsDaoImpl();
                UserCredentialsVO cloudKeys = ucDao.getByCertUniqueId(uniqueId);
                if (null == cloudKeys) {
                    logger.error("Cert does not map to Cloud API keys: " + uniqueId);
                    throw new AxisFault("User not properly registered: Certificate does not map to Cloud API Keys", "Client.Blocked");
                } else
                    UserContext.current().initContext(cloudKeys.getAccessKey(), cloudKeys.getSecretKey(), cloudKeys.getAccessKey(), "SOAP Request", null);
View Full Code Here

  public UserInfo getUserInfo(String accessKey)
      throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
    UserInfo info = new UserInfo();

    UserCredentialsDao credentialDao = new UserCredentialsDao();
    UserCredentials cloudKeys = credentialDao.getByAccessKey( accessKey );
    if ( null == cloudKeys ) {
      logger.debug( accessKey + " is not defined in the S3 service - call SetUserKeys" );
      return null;
    } else {
      info.setAccessKey( accessKey );
View Full Code Here

    UserContext context = UserContext.current();

        try {
            // -> use the keys to see if the account actually exists
          ServiceProvider.getInstance().getEC2Engine().validateAccount( accessKey[0], secretKey[0] );
          UserCredentialsDao credentialDao = new UserCredentialsDao();
          credentialDao.setUserKeys( accessKey[0], secretKey[0] );
         
        } catch( Exception e ) {
           logger.error("SetUserKeys " + e.getMessage(), e);
        response.setStatus(401);
          endResponse(response, e.toString());
View Full Code Here

          certStore.store( fsOut, keystorePassword.toCharArray());
         
          // [C] Associate the cert's uniqueId with the Cloud API keys
            String uniqueId = AuthenticationUtils.X509CertUniqueId( userCert );
            logger.debug( "SetCertificate, uniqueId: " + uniqueId );
          UserCredentialsDao credentialDao = new UserCredentialsDao();
          credentialDao.setCertificateId( accessKey[0], uniqueId );
        response.setStatus(200);
            endResponse(response, "User certificate set successfully");
         
      } catch( NoSuchObjectException e ) {
        logger.error("SetCertificate exception " + e.getMessage(), e);
View Full Code Here

                certStore.deleteEntry( accessKey[0] );
                FileOutputStream fsOut = new FileOutputStream( pathToKeystore );
               certStore.store( fsOut, keystorePassword.toCharArray());
              
              // -> dis-associate the cert's uniqueId with the Cloud API keys
              UserCredentialsDao credentialDao = new UserCredentialsDao();
              credentialDao.setCertificateId( accessKey[0], null );
             response.setStatus(200);
               endResponse(response, "User certificate deleted successfully");
          }
          else response.setStatus(404);
         
View Full Code Here

                  return false;
             }
    }
   
    // [B] Use the cloudAccessKey to get the users secret key in the db
      UserCredentialsDao credentialDao = new UserCredentialsDao();
      UserCredentials cloudKeys = credentialDao.getByAccessKey( cloudAccessKey );
      if ( null == cloudKeys )
      {
         logger.debug( cloudAccessKey + " is not defined in the EC2 service - call SetUserKeys" );
           response.sendError(404, cloudAccessKey + " is not defined in the EC2 service - call SetUserKeys" );
           return false;
View Full Code Here

                //System.out.println( "cert: " + userCert.toString());             
                String uniqueId = AuthenticationUtils.X509CertUniqueId( userCert );
                logger.debug( "X509 cert's uniqueId: " + uniqueId );
               
                // -> find the Cloud API key and the secret key from the cert's uniqueId
             UserCredentialsDao credentialDao = new UserCredentialsDao();
             UserCredentials cloudKeys = credentialDao.getByCertUniqueId( uniqueId );
             if ( null == cloudKeys ) {
                 logger.error( "Cert does not map to Cloud API keys: " + uniqueId );
              throw new AxisFault( "User not properly registered: Certificate does not map to Cloud API Keys", "Client.Blocked" );
             }
             else UserContext.current().initContext( cloudKeys.getAccessKey(), cloudKeys.getSecretKey(), cloudKeys.getAccessKey(), "SOAP Request", null );
View Full Code Here

      * @return the secret key or null of no matching user found
      */
     private String lookupSecretKey( String accessKey )
      throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
     {
       UserCredentialsDao credentialDao = new UserCredentialsDao();
      UserCredentials cloudKeys = credentialDao.getByAccessKey( accessKey );
      if ( null == cloudKeys ) {
         logger.debug( accessKey + " is not defined in the S3 service - call SetUserKeys" );
           return null;
      }
    else return cloudKeys.getSecretKey();
View Full Code Here

        }

        try {
            // -> use the keys to see if the account actually exists
          //ServiceProvider.getInstance().getEC2Engine().validateAccount( accessKey[0], secretKey[0] );
          UserCredentialsDao credentialDao = new UserCredentialsDao();
          credentialDao.setUserKeys( accessKey[0], secretKey[0] );
         
        } catch( Exception e ) {
           logger.error("SetUserKeys " + e.getMessage(), e);
        response.setStatus(401);
          endResponse(response, e.toString());
View Full Code Here

TOP

Related Classes of com.cloud.bridge.persist.dao.UserCredentialsDao

Copyright © 2018 www.massapicom. 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.