77
88import com .sap .cloud .security .config .Environment ;
99import com .sap .cloud .security .config .Environments ;
10+ import com .sap .cloud .security .config .OAuth2ServiceConfiguration ;
1011import org .slf4j .Logger ;
1112import org .slf4j .LoggerFactory ;
1213import org .springframework .core .env .PropertiesPropertySource ;
@@ -76,19 +77,22 @@ public PropertySource<?> createPropertySource(String name, EncodedResource resou
7677 @ Nonnull
7778 private Properties getXsuaaProperties (Environment environment , boolean multipleXsuaaServicesBound ) {
7879 Properties properties = new Properties ();
79- if (environment .getXsuaaConfiguration () != null ) {
80+ final OAuth2ServiceConfiguration xsuaaConfiguration = environment .getXsuaaConfiguration ();
81+ if (xsuaaConfiguration != null ) {
8082 String xsuaaPrefix = multipleXsuaaServicesBound ? PROPERTIES_KEY + ".xsuaa[0]." : XSUAA_PREFIX ;
8183 for (String key : XSUAA_ATTRIBUTES ) {
82- if (environment . getXsuaaConfiguration () .hasProperty (key )) {
83- properties .put (xsuaaPrefix + key , environment . getXsuaaConfiguration () .getProperty (key ));
84+ if (xsuaaConfiguration .hasProperty (key )) {
85+ properties .put (xsuaaPrefix + key , xsuaaConfiguration .getProperty (key ));
8486 }
8587 }
8688 }
8789 if (multipleXsuaaServicesBound ) {
90+ final OAuth2ServiceConfiguration xsuaaConfigurationForTokenExchange =
91+ environment .getXsuaaConfigurationForTokenExchange ();
8892 for (String key : XSUAA_ATTRIBUTES ) {
89- if (environment . getXsuaaConfigurationForTokenExchange () .hasProperty (key )) {
93+ if (xsuaaConfigurationForTokenExchange .hasProperty (key )) {
9094 properties .put (PROPERTIES_KEY + ".xsuaa[1]." + key ,
91- environment . getXsuaaConfigurationForTokenExchange () .getProperty (key ));
95+ xsuaaConfigurationForTokenExchange .getProperty (key ));
9296 }
9397 }
9498 }
@@ -98,13 +102,14 @@ private Properties getXsuaaProperties(Environment environment, boolean multipleX
98102 @ Nonnull
99103 private Properties getIasProperties (Environment environment ) {
100104 Properties properties = new Properties ();
101- if (environment .getIasConfiguration () != null ) {
105+ final OAuth2ServiceConfiguration iasConfiguration = environment .getIasConfiguration ();
106+ if (iasConfiguration != null ) {
102107 for (String key : IAS_ATTRIBUTES ) {
103- if (environment . getIasConfiguration () .hasProperty (key )) { // will not find "domains" among properties
104- properties .put (IAS_PREFIX + key , environment . getIasConfiguration () .getProperty (key ));
108+ if (iasConfiguration .hasProperty (key )) { // will not find "domains" among properties
109+ properties .put (IAS_PREFIX + key , iasConfiguration .getProperty (key ));
105110 }
106111 }
107- properties .put (IAS_PREFIX + DOMAINS , environment . getIasConfiguration () .getDomains ());
112+ properties .put (IAS_PREFIX + DOMAINS , iasConfiguration .getDomains ());
108113 }
109114 return properties ;
110115 }
0 commit comments