You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "turcsanyip (via GitHub)" <gi...@apache.org> on 2023/03/12 17:40:07 UTC

[GitHub] [nifi] turcsanyip commented on a diff in pull request #7021: NIFI-11260: Added SSL Context Service in AWSCredentialsProviderContro…

turcsanyip commented on code in PR #7021:
URL: https://github.com/apache/nifi/pull/7021#discussion_r1133295895


##########
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/credentials/provider/factory/strategies/AssumeRoleCredentialsStrategy.java:
##########
@@ -190,29 +202,27 @@ public AWSCredentialsProvider getDerivedCredentialsProvider(final Map<PropertyDe
     }
 
     @Override
-    public AwsCredentialsProvider getAwsCredentialsProvider(final Map<PropertyDescriptor, String> properties) {
+    public AwsCredentialsProvider getAwsCredentialsProvider(final PropertyContext propertyContext) {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public AwsCredentialsProvider getDerivedAwsCredentialsProvider(final Map<PropertyDescriptor, String> properties,
-                                                                   AwsCredentialsProvider primaryCredentialsProvider) {
-        final String assumeRoleArn = properties.get(ASSUME_ROLE_ARN);
-        final String assumeRoleName = properties.get(ASSUME_ROLE_NAME);
-        String rawMaxSessionTime = properties.get(MAX_SESSION_TIME);
-        rawMaxSessionTime = rawMaxSessionTime == null ? MAX_SESSION_TIME.getDefaultValue() : rawMaxSessionTime;
-        final Integer maxSessionTime = Integer.parseInt(rawMaxSessionTime.trim());
-        final String assumeRoleExternalId = properties.get(ASSUME_ROLE_EXTERNAL_ID);
-        final String assumeRoleSTSEndpoint = properties.get(ASSUME_ROLE_STS_ENDPOINT);
-        final String stsRegion = properties.get(ASSUME_ROLE_STS_REGION);
+    public AwsCredentialsProvider getDerivedAwsCredentialsProvider(final PropertyContext propertyContext,
+                                                                   final AwsCredentialsProvider primaryCredentialsProvider) {
+        final String assumeRoleArn = propertyContext.getProperty(ASSUME_ROLE_ARN).getValue();
+        final String assumeRoleName = propertyContext.getProperty(ASSUME_ROLE_NAME).getValue();
+        final int maxSessionTime = propertyContext.getProperty(MAX_SESSION_TIME).asInteger();
+        final String assumeRoleExternalId = propertyContext.getProperty(ASSUME_ROLE_EXTERNAL_ID).getValue();
+        final String assumeRoleSTSEndpoint = propertyContext.getProperty(ASSUME_ROLE_STS_ENDPOINT).getValue();
+        final String stsRegion = propertyContext.getProperty(ASSUME_ROLE_STS_REGION).getValue();
 
         final StsAssumeRoleCredentialsProvider.Builder builder = StsAssumeRoleCredentialsProvider.builder();
 
         // If proxy variables are set, then create Client Configuration with those values
         final ApacheHttpClient.Builder httpClientBuilder = ApacheHttpClient.builder();

Review Comment:
   @exceptionfactory Thanks for the hint! I updated the PR.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org