Search in sources :

Example 1 with S3SecretManagerImpl

use of org.apache.hadoop.ozone.om.S3SecretManagerImpl in project ozone by apache.

the class TestOzoneDelegationTokenSecretManager method setUp.

@Before
public void setUp() throws Exception {
    conf = createNewTestPath();
    securityConfig = new SecurityConfig(conf);
    certificateClient = setupCertificateClient();
    certificateClient.init();
    expiryTime = Time.monotonicNow() + 60 * 60 * 24;
    serviceRpcAdd = new Text("localhost");
    final Map<String, String> s3Secrets = new HashMap<>();
    s3Secrets.put("testuser1", s3Secret);
    s3Secrets.put("abc", "djakjahkd");
    om = Mockito.mock(OzoneManager.class);
    OMMetadataManager metadataManager = new OmMetadataManagerImpl(conf);
    s3SecretManager = new S3SecretManagerImpl(conf, metadataManager) {

        @Override
        public S3SecretValue getS3Secret(String kerberosID) {
            if (s3Secrets.containsKey(kerberosID)) {
                return new S3SecretValue(kerberosID, s3Secrets.get(kerberosID));
            }
            return null;
        }

        @Override
        public String getS3UserSecretString(String awsAccessKey) {
            if (s3Secrets.containsKey(awsAccessKey)) {
                return s3Secrets.get(awsAccessKey);
            }
            return null;
        }
    };
}
Also used : OmMetadataManagerImpl(org.apache.hadoop.ozone.om.OmMetadataManagerImpl) SecurityConfig(org.apache.hadoop.hdds.security.x509.SecurityConfig) HashMap(java.util.HashMap) OzoneManager(org.apache.hadoop.ozone.om.OzoneManager) OMMetadataManager(org.apache.hadoop.ozone.om.OMMetadataManager) Text(org.apache.hadoop.io.Text) S3SecretManagerImpl(org.apache.hadoop.ozone.om.S3SecretManagerImpl) S3SecretValue(org.apache.hadoop.ozone.om.helpers.S3SecretValue) Before(org.junit.Before)

Aggregations

HashMap (java.util.HashMap)1 SecurityConfig (org.apache.hadoop.hdds.security.x509.SecurityConfig)1 Text (org.apache.hadoop.io.Text)1 OMMetadataManager (org.apache.hadoop.ozone.om.OMMetadataManager)1 OmMetadataManagerImpl (org.apache.hadoop.ozone.om.OmMetadataManagerImpl)1 OzoneManager (org.apache.hadoop.ozone.om.OzoneManager)1 S3SecretManagerImpl (org.apache.hadoop.ozone.om.S3SecretManagerImpl)1 S3SecretValue (org.apache.hadoop.ozone.om.helpers.S3SecretValue)1 Before (org.junit.Before)1