当前位置: 首页>>代码示例>>Java>>正文


Java ClientCredentialsResourceDetails.setClientAuthenticationScheme方法代码示例

本文整理汇总了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;
}
 
开发者ID:PacktPublishing,项目名称:OAuth-2.0-Cookbook,代码行数:18,代码来源:ClientConfiguration.java

示例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);
}
 
开发者ID:cloudfoundry-community,项目名称:oauth-register-broker,代码行数:21,代码来源:UaaDriver.java

示例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;
}
 
开发者ID:kbastani,项目名称:cloud-native-microservice-strangler-example,代码行数:15,代码来源:UserApplication.java

示例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


注:本文中的org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails.setClientAuthenticationScheme方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。