Package com.cloud.bridge.model

Examples of com.cloud.bridge.model.UserCredentialsVO


    public UserInfo getUserInfo(String accessKey) {
        UserInfo info = new UserInfo();
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB);
        try {
            txn.start();
            UserCredentialsVO cloudKeys = ucDao.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;
            }
        } finally {
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 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);
                //System.out.println( "end of cert match: " + UserContext.current().getSecretKey());
            }
        } catch (AxisFault e) {
            throw e;
        } catch (Exception e) {
View Full Code Here

     *
     * @param accessKey - a unique string allocated for each registered user
     * @return the secret key or null of no matching user found
     */
    private String lookupSecretKey(String accessKey) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
        UserCredentialsVO cloudKeys = ucDao.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

            // -> use the keys to see if the account actually exists
            //ServiceProvider.getInstance().getEC2Engine().validateAccount( accessKey[0], secretKey[0] );
            //UserCredentialsDaoImpl credentialDao = new UserCredentialsDao();
            TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB);
            txn.start();
            UserCredentialsVO user = new UserCredentialsVO(accessKey[0], secretKey[0]);
            user = ucDao.persist(user);
            txn.commit();
            txn.close();
            //credentialDao.setUserKeys( accessKey[0], secretKey[0] );
View Full Code Here

            // -> use the keys to see if the account actually exists
          //ServiceProvider.getInstance().getEC2Engine().validateAccount( accessKey[0], secretKey[0] );
          //UserCredentialsDaoImpl credentialDao = new UserCredentialsDao();
            Transaction txn = Transaction.open(Transaction.AWSAPI_DB);
            txn.start();
          UserCredentialsVO user = new UserCredentialsVO(accessKey[0], secretKey[0]);
          user = ucDao.persist(user);
          txn.commit();
          txn.close();
          //credentialDao.setUserKeys( accessKey[0], secretKey[0] );
         
View Full Code Here

  public UserInfo getUserInfo(String accessKey) {
    UserInfo info = new UserInfo();
    Transaction txn = Transaction.open(Transaction.AWSAPI_DB);
    try {
        txn.start();
        UserCredentialsVO cloudKeys = ucDao.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;
        }
    }finally {
View Full Code Here

            txn = Transaction.open(Transaction.AWSAPI_DB);
            // -> use the keys to see if the account actually exists
          ServiceProvider.getInstance().getEC2Engine().validateAccount( accessKey[0], secretKey[0] );
/*          UserCredentialsDao credentialDao = new UserCredentialsDao();
          credentialDao.setUserKeys(  );
*/          UserCredentialsVO user = new UserCredentialsVO(accessKey[0], secretKey[0]);
          ucDao.persist(user);
          txn.commit();
     
        } catch( Exception e ) {
           logger.error("SetUserKeys " + e.getMessage(), e);
View Full Code Here

            logger.debug( "SetCertificate, uniqueId: " + uniqueId );
/*          UserCredentialsDao credentialDao = new UserCredentialsDao();
          credentialDao.setCertificateId( accessKey[0], uniqueId );
*/         
            txn = Transaction.open(Transaction.AWSAPI_DB);
            UserCredentialsVO user = ucDao.getByAccessKey(accessKey[0]);
            user.setCertUniqueId(uniqueId);
            ucDao.update(user.getId(), user);
            response.setStatus(200);
            endResponse(response, "User certificate set successfully");
            txn.commit();
         
      } catch( NoSuchObjectException e ) {
View Full Code Here

              // -> dis-associate the cert's uniqueId with the Cloud API keys
/*              UserCredentialsDao credentialDao = new UserCredentialsDao();
              credentialDao.setCertificateId( accessKey[0], null );
             
*/              txn = Transaction.open(Transaction.AWSAPI_DB);
               UserCredentialsVO user = ucDao.getByAccessKey(accessKey[0]);
              user.setCertUniqueId(null);
              ucDao.update(user.getId(), user);
             response.setStatus(200);
             endResponse(response, "User certificate deleted successfully");
             txn.commit();
          }
          else response.setStatus(404);
View Full Code Here

                  return false;
             }
    }
   
    // [B] Use the cloudAccessKey to get the users secret key in the db
      UserCredentialsVO cloudKeys = ucDao.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

TOP

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

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.