本文整理汇总了Java中org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails.setClientAuthenticationScheme方法的典型用法代码示例。如果您正苦于以下问题:Java ClientCredentialsResourceDetails.setClientAuthenticationScheme方法的具体用法?Java ClientCredentialsResourceDetails.setClientAuthenticationScheme怎么用?Java ClientCredentialsResourceDetails.setClientAuthenticationScheme使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails
的用法示例。
在下文中一共展示了ClientCredentialsResourceDetails.setClientAuthenticationScheme方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: passwordResourceDetails
import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails; //导入方法依赖的package包/类
@Bean
public OAuth2ProtectedResourceDetails passwordResourceDetails() {
//@formatter:off
ClientCredentialsResourceDetails details = new ClientCredentialsResourceDetails();
details.setId("oauth2server");
details.setTokenName("oauth_token");
details.setClientId("clientadmin");
details.setClientSecret("123");
details.setAccessTokenUri("http://localhost:8080/oauth/token");
details.setScope(Arrays.asList("admin"));
details.setClientAuthenticationScheme(AuthenticationScheme.header);
//@formatter:on
return details;
}
示例2: connect
import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails; //导入方法依赖的package包/类
private UaaConnection connect(String providerUser, String providerPassword) throws DriverConnectionException {
if (uaaUrl == null) {
throw new DriverConnectionException(this, "Uaa is not registered in the broker, this driver can't be used");
}
ClientCredentialsResourceDetails credentials = new ClientCredentialsResourceDetails();
credentials.setAccessTokenUri(uaaUrl + "/oauth/token");
credentials.setClientAuthenticationScheme(AuthenticationScheme.header);
credentials.setClientId(providerUser);
credentials.setClientSecret(providerPassword);
URL uaaHost = null;
try {
uaaHost = new URL(uaaUrl);
} catch (MalformedURLException e) {
throw new DriverConnectionException(this, e.getMessage(), e);
}
return UaaConnectionFactory.getConnection(uaaHost, credentials);
}
示例3: loadBalancedOauth2RestTemplate
import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails; //导入方法依赖的package包/类
@LoadBalanced
@Bean
public OAuth2RestTemplate loadBalancedOauth2RestTemplate(ClientCredentialsResourceDetails resource) {
ClientCredentialsResourceDetails clientCredentialsResourceDetails = new ClientCredentialsResourceDetails();
clientCredentialsResourceDetails.setAccessTokenUri(resource.getAccessTokenUri());
clientCredentialsResourceDetails.setClientId(resource.getClientId());
clientCredentialsResourceDetails.setClientSecret(resource.getClientSecret());
clientCredentialsResourceDetails.setClientAuthenticationScheme(resource.getClientAuthenticationScheme());
clientCredentialsResourceDetails.setScope(resource.getScope());
clientCredentialsResourceDetails.setGrantType(resource.getGrantType());
OAuth2RestTemplate auth2RestTemplate = new OAuth2RestTemplate(clientCredentialsResourceDetails);
auth2RestTemplate.setAccessTokenProvider(new ClientCredentialsAccessTokenProvider());
return auth2RestTemplate;
}
示例4: loadBalancedOauth2RestTemplate
import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails; //导入方法依赖的package包/类
@LoadBalanced
@Bean
public OAuth2RestTemplate loadBalancedOauth2RestTemplate(
ClientCredentialsResourceDetails resource) {
ClientCredentialsResourceDetails clientCredentialsResourceDetails = new ClientCredentialsResourceDetails();
clientCredentialsResourceDetails.setAccessTokenUri(resource.getAccessTokenUri());
clientCredentialsResourceDetails.setClientId(resource.getClientId());
clientCredentialsResourceDetails.setClientSecret(resource.getClientSecret());
clientCredentialsResourceDetails.setClientAuthenticationScheme(resource.getClientAuthenticationScheme());
clientCredentialsResourceDetails.setScope(resource.getScope());
clientCredentialsResourceDetails.setGrantType(resource.getGrantType());
OAuth2RestTemplate auth2RestTemplate = new OAuth2RestTemplate(clientCredentialsResourceDetails);
auth2RestTemplate.setAccessTokenProvider(new ClientCredentialsAccessTokenProvider());
return auth2RestTemplate;
}
开发者ID:kbastani,项目名称:cloud-native-microservice-strangler-example,代码行数:16,代码来源:LegacyEdgeApplication.java