@Bean @Lazy @ConditionalOnMissingBean public PasswordGrantTokenProvider tokenProvider() { String username = this.cloudFoundryProperties.getUsername(); String password = this.cloudFoundryProperties.getPassword(); return PasswordGrantTokenProvider.builder() .password(password) .username(username) .build(); } }
.build(); TokenProvider tokenProvider = PasswordGrantTokenProvider.builder() .username(connectionProperties.getUsername()) .password(connectionProperties.getPassword()).build(); CloudFoundryClient cloudFoundryClient = ReactorCloudFoundryClient.builder() .connectionContext(connectionContext).tokenProvider(tokenProvider)
.build(); TokenProvider tokenProvider = PasswordGrantTokenProvider.builder() .username(connectionProperties.getUsername()) .password(connectionProperties.getPassword()).build(); CloudFoundryClient cloudFoundryClient = ReactorCloudFoundryClient.builder() .connectionContext(connectionContext).tokenProvider(tokenProvider)
.build(); TokenProvider tokenProvider = PasswordGrantTokenProvider.builder() .username(connectionProperties.getUsername()) .password(connectionProperties.getPassword()).build(); CloudFoundryClient cloudFoundryClient = ReactorCloudFoundryClient.builder() .connectionContext(connectionContext).tokenProvider(tokenProvider)
.build(); TokenProvider tokenProvider = PasswordGrantTokenProvider.builder() .username(connectionProperties.getUsername()) .password(connectionProperties.getPassword()).build(); CloudFoundryClient cloudFoundryClient = ReactorCloudFoundryClient.builder() .connectionContext(connectionContext).tokenProvider(tokenProvider)
private CloudFoundryOperations buildCloudFoundryOperations(String platformName) { CloudFoundryPlatformProperties.CloudFoundryProperties cloudFoundryProperties = this.cloudFoundryPlatformProperties .getAccounts() .get(platformName); CloudFoundryConnectionProperties connectionProperties = cloudFoundryProperties.getConnection(); ConnectionContext connectionContext = DefaultConnectionContext.builder() .apiHost(connectionProperties.getUrl().getHost()) .skipSslValidation(connectionProperties.isSkipSslValidation()) .build(); TokenProvider tokenProvider = PasswordGrantTokenProvider.builder() .username(connectionProperties.getUsername()) .password(connectionProperties.getPassword()).build(); CloudFoundryClient cloudFoundryClient = ReactorCloudFoundryClient.builder() .connectionContext(connectionContext) .tokenProvider(tokenProvider) .build(); return DefaultCloudFoundryOperations .builder().cloudFoundryClient(cloudFoundryClient) .organization(connectionProperties.getOrg()) .space(connectionProperties.getSpace()).build(); } }
private TokenProvider createTokenProvider(CFClientParams params) { CFCredentials creds = params.getCredentials(); switch (creds.getType()) { case PASSWORD: return PasswordGrantTokenProvider.builder() .username(params.getUsername()) .password(creds.getSecret()) .build(); case REFRESH_TOKEN: return RefreshTokenGrantTokenProvider.builder() .token(creds.getSecret()) .build(); case TEMPORARY_CODE: return OneTimePasscodeTokenProvider.builder() .passcode(creds.getSecret()) .build(); default: throw new IllegalStateException("BUG! Missing switch case?"); } }
protected TokenProvider getTokenProvider(CfProperties cfAppProperties) { if (cfAppProperties.ccToken() == null && (cfAppProperties.ccUser() == null && cfAppProperties.ccPassword() == null)) { throw new IllegalStateException("One of token or user/password should be provided"); } if (cfAppProperties.ccToken() != null) { return new StaticTokenProvider(cfAppProperties.ccToken()); } else { return PasswordGrantTokenProvider.builder() .password(cfAppProperties.ccPassword()) .username(cfAppProperties.ccUser()) .build(); } }
@Bean @Lazy @ConditionalOnMissingBean public PasswordGrantTokenProvider tokenProvider() { String username = this.cloudFoundryProperties.getUsername(); String password = this.cloudFoundryProperties.getPassword(); return PasswordGrantTokenProvider.builder() .password(password) .username(username) .build(); } }