Package com.sequenceiq.cloudbreak.domain

Examples of com.sequenceiq.cloudbreak.domain.TemporaryAwsCredentials


                result.getCredentials().getSessionToken());
    }

    private BasicSessionCredentials getCachedCredentials(AwsCredential awsCredential) {
        long dateNow = new Date().getTime();
        TemporaryAwsCredentials temporaryAwsCredentials = awsCredential.getTemporaryAwsCredentials();
        if (temporaryAwsCredentials != null) {
            if (temporaryAwsCredentials.getValidUntil() > dateNow + FIVE_MINUTES) {
                return new BasicSessionCredentials(
                        temporaryAwsCredentials.getAccessKeyId(),
                        temporaryAwsCredentials.getSecretAccessKey(),
                        temporaryAwsCredentials.getSessionToken());
            } else {
                awsCredential.setTemporaryAwsCredentials(null);
                credentialRepository.save(awsCredential);
                credentialsRepository.delete(temporaryAwsCredentials);
            }
View Full Code Here


        }
        return null;
    }

    private void cacheSessionCredentials(AssumeRoleResult result, int durationInSeconds, AwsCredential awsCredential) {
        TemporaryAwsCredentials temporaryAwsCredentials = new TemporaryAwsCredentials();
        temporaryAwsCredentials.setAccessKeyId(result.getCredentials().getAccessKeyId());
        temporaryAwsCredentials.setSecretAccessKey(result.getCredentials().getSecretAccessKey());
        temporaryAwsCredentials.setSessionToken(result.getCredentials().getSessionToken());
        temporaryAwsCredentials.setValidUntil(new Date().getTime() + durationInSeconds * MILLISECONDS);
        credentialsRepository.save(temporaryAwsCredentials);
        awsCredential.setTemporaryAwsCredentials(temporaryAwsCredentials);
        credentialRepository.save(awsCredential);

    }
View Full Code Here

        awsCredential.setId(1L);
        awsCredential.setName(DUMMY_NAME);
        awsCredential.setRoleArn(DUMMY_ROLE_ARN);
        awsCredential.setSnsTopics(new HashSet<SnsTopic>());
        awsCredential.setDescription(DUMMY_DESCRIPTION);
        awsCredential.setTemporaryAwsCredentials(new TemporaryAwsCredentials());
        awsCredential.setCloudPlatform(CloudPlatform.AWS);
        awsCredential.setPublicInAccount(true);
        return awsCredential;
    }
View Full Code Here

TOP

Related Classes of com.sequenceiq.cloudbreak.domain.TemporaryAwsCredentials

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.