Examples of UserCredentialsVO


Examples of com.cloud.bridge.model.UserCredentialsVO

    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

Examples of com.cloud.bridge.model.UserCredentialsVO

            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

Examples of com.cloud.bridge.model.UserCredentialsVO

            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

Examples of com.cloud.bridge.model.UserCredentialsVO

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

Examples of com.cloud.bridge.model.UserCredentialsVO

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

Examples of com.cloud.bridge.model.UserCredentialsVO

            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;
View Full Code Here

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

Examples of com.cloud.bridge.model.UserCredentialsVO

        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

Examples of com.cloud.bridge.model.UserCredentialsVO

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

Examples of com.cloud.bridge.model.UserCredentialsVO

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