Package com.cloud.bridge.model

Examples of com.cloud.bridge.model.UserCredentials


  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 );
      info.setSecretKey( cloudKeys.getSecretKey());
      info.setCanonicalUserId(accessKey);
      info.setDescription( "S3 REST request" );
      return info;
    }
  }
View Full Code Here


    }
  }
 
  public void setUserKeys( String cloudAccessKey, String cloudSecretKey )
      throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
    UserCredentials user = getByAccessKey( cloudAccessKey );
    PreparedStatement statement = null;
 
      openConnection()
        try {
        if ( null == user ) {
View Full Code Here

      }
  }

  public void setCertificateId( String cloudAccessKey, String certId )
        throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
      UserCredentials user = getByAccessKey( cloudAccessKey );
      PreparedStatement statement = null;

      if (null == user) throw new NoSuchObjectException( "Cloud API Access Key [" + cloudAccessKey + "] is unknown" );
     
        openConnection()
View Full Code Here

  public UserCredentials getByAccessKey( String cloudAccessKey )
      throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
    openConnection();
   
    UserCredentials user = null;
   
    try {
        PreparedStatement statement = conn.prepareStatement ( "SELECT SecretKey, CertUniqueId FROM usercredentials WHERE AccessKey=?" );
        statement.setString( 1, cloudAccessKey );
        statement.executeQuery();
        ResultSet rs = statement.getResultSet ();
        if (rs.next()) {
          user = new UserCredentials();
          user.setAccessKey( cloudAccessKey );
            user.setSecretKey( rs.getString( "SecretKey" ));
            user.setCertUniqueId( rs.getString( "CertUniqueId" ));
        }

    } finally {
             closeConnection();
   
View Full Code Here

  public UserCredentials getByCertUniqueId( String certId )
        throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
      openConnection();
 
      UserCredentials user = null;
 
      try {
          PreparedStatement statement = conn.prepareStatement ( "SELECT AccessKey, SecretKey FROM usercredentials WHERE CertUniqueId=?" );
          statement.setString( 1, certId );
          statement.executeQuery();
          ResultSet rs = statement.getResultSet ();
          if (rs.next()) {
            user = new UserCredentials();
            user.setAccessKey( rs.getString( "AccessKey" ));
              user.setSecretKey( rs.getString( "SecretKey" ));
              user.setCertUniqueId( certId );
          }

      } finally {
            closeConnection();
     
View Full Code Here

             }
    }
   
    // [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;
      }
    else cloudSecretKey = cloudKeys.getSecretKey();

   
    // [C] Verify the signature
    //  -> getting the query-string in this way maintains its URL encoding
       EC2RestAuth restAuth = new EC2RestAuth();
View Full Code Here

                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 );
                //System.out.println( "end of cert match: " + UserContext.current().getSecretKey());
          }
      }
      catch (AxisFault e) {
        throw e;
View Full Code Here

      */
     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

TOP

Related Classes of com.cloud.bridge.model.UserCredentials

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.