Package com.cloud.bridge.model

Examples of com.cloud.bridge.model.UserCredentialsVO


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


               
                // -> find the Cloud API key and the secret key from the cert's uniqueId
/*             UserCredentialsDao credentialDao = new UserCredentialsDao();
             UserCredentials cloudKeys = credentialDao.getByCertUniqueId( uniqueId );
*/            
                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;
View Full Code Here

    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

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

            // [C] Associate the cert's uniqueId with the Cloud API keys
            String uniqueId = AuthenticationUtils.X509CertUniqueId( userCert );
            logger.debug( "SetCertificate, uniqueId: " + uniqueId );
            txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB);
            txn.start();
            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 = TransactionLegacy.open(TransactionLegacy.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

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

            // -> find the Cloud API key and the secret key from the cert's uniqueId
            /*             UserCredentialsDao credentialDao = new UserCredentialsDao();
             UserCredentials cloudKeys = credentialDao.getByCertUniqueId( uniqueId );
             */            
            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;
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

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.