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


Java ResourceOwnerPasswordAccessTokenProvider类代码示例

本文整理汇总了Java中org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordAccessTokenProvider的典型用法代码示例。如果您正苦于以下问题:Java ResourceOwnerPasswordAccessTokenProvider类的具体用法?Java ResourceOwnerPasswordAccessTokenProvider怎么用?Java ResourceOwnerPasswordAccessTokenProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResourceOwnerPasswordAccessTokenProvider类属于org.springframework.security.oauth2.client.token.grant.password包,在下文中一共展示了ResourceOwnerPasswordAccessTokenProvider类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MyOAuth2RestTemplate

import org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordAccessTokenProvider; //导入依赖的package包/类
public MyOAuth2RestTemplate(OAuth2ProtectedResourceDetails resource, OAuth2ClientContext context) {
    super(resource, context);
    this.accessTokenProvider = new MyAccessTokenProviderChain(Arrays.asList(new AccessTokenProvider[]{new MyAuthorizationCodeAccessTokenProvider(),
            new ImplicitAccessTokenProvider(),
            new ResourceOwnerPasswordAccessTokenProvider(),
            new ClientCredentialsAccessTokenProvider()}));
    this.retryBadAccessTokens = true;
    this.authenticator = new DefaultOAuth2RequestAuthenticator();
    if(resource == null) {
        throw new IllegalArgumentException("An OAuth2 resource must be supplied.");
    } else {
        this.resource = resource;
        this.context = context;
        this.setErrorHandler(new OAuth2ErrorHandler(resource));
    }
}
 
开发者ID:luotuo,项目名称:springboot-security-wechat,代码行数:17,代码来源:MyOAuth2RestTemplate.java

示例2: createToken

import org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordAccessTokenProvider; //导入依赖的package包/类
private OAuth2AccessToken createToken(String username, String password, String clientId, String clientSecret) {
    OAuth2ProtectedResourceDetails resource = getResourceDetails(username, password, clientId, clientSecret);
    AccessTokenRequest request = createAccessTokenRequest(username, password);

    ResourceOwnerPasswordAccessTokenProvider provider = createResourceOwnerPasswordAccessTokenProvider();
    try {
        return provider.obtainAccessToken(resource, request);
    } catch (OAuth2AccessDeniedException oauthEx) {
        HttpStatus status = HttpStatus.valueOf(oauthEx.getHttpErrorCode());
        throw new CloudFoundryException(status, oauthEx.getMessage(), oauthEx.getSummary());
    }
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:13,代码来源:OauthClient.java

示例3: refreshToken

import org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordAccessTokenProvider; //导入依赖的package包/类
private OAuth2AccessToken refreshToken(OAuth2AccessToken currentToken, String username, String password, String clientId,
    String clientSecret) {
    OAuth2ProtectedResourceDetails resource = getResourceDetails(username, password, clientId, clientSecret);
    AccessTokenRequest request = createAccessTokenRequest(username, password);

    ResourceOwnerPasswordAccessTokenProvider provider = createResourceOwnerPasswordAccessTokenProvider();

    return provider.refreshAccessToken(resource, currentToken.getRefreshToken(), request);
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:10,代码来源:OauthClient.java

示例4: FeignOAuthInterceptor

import org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordAccessTokenProvider; //导入依赖的package包/类
public FeignOAuthInterceptor(OAuth2ClientContext oAuth2ClientContext) {
	super(oAuth2ClientContext, null);
	this.oAuth2ClientContext = oAuth2ClientContext;
	this.accessTokenProvider = new AccessTokenProviderChain(Arrays.asList(new AuthorizationCodeAccessTokenProvider(),
			new ImplicitAccessTokenProvider(), new ResourceOwnerPasswordAccessTokenProvider(),
			new ClientCredentialsAccessTokenProvider()));
}
 
开发者ID:rhawan,项目名称:microservices-tcc-alfa,代码行数:8,代码来源:FeignOAuthInterceptor.java

示例5: accessTokenProviderChain

import org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordAccessTokenProvider; //导入依赖的package包/类
@Bean
public AccessTokenProvider accessTokenProviderChain() {
    return new AccessTokenProviderChain(Arrays.<AccessTokenProvider> asList(
        new OpenIDTokenProvider(),
        new AuthorizationCodeAccessTokenProvider(), new ImplicitAccessTokenProvider(),
        new ResourceOwnerPasswordAccessTokenProvider(), new ClientCredentialsAccessTokenProvider()));
}
 
开发者ID:pivotal-cf,项目名称:identity-sample-apps,代码行数:8,代码来源:Application.java

示例6: createResourceOwnerPasswordAccessTokenProvider

import org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordAccessTokenProvider; //导入依赖的package包/类
protected ResourceOwnerPasswordAccessTokenProvider createResourceOwnerPasswordAccessTokenProvider() {
    ResourceOwnerPasswordAccessTokenProvider resourceOwnerPasswordAccessTokenProvider = new ResourceOwnerPasswordAccessTokenProvider();
    resourceOwnerPasswordAccessTokenProvider.setRequestFactory(restTemplate.getRequestFactory()); // copy the http proxy along
    return resourceOwnerPasswordAccessTokenProvider;
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:6,代码来源:OauthClient.java

示例7: oauth2RestTemplate

import org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordAccessTokenProvider; //导入依赖的package包/类
@Bean
public OAuth2RestTemplate oauth2RestTemplate() {

    OAuth2ProtectedResourceDetails resourceDetails = passwordResourceDetails();

    OAuth2RestTemplate template = new OAuth2RestTemplate(resourceDetails,
            oauth2ClientContext);

    AccessTokenProviderChain provider = new AccessTokenProviderChain(
            Arrays.asList(new ResourceOwnerPasswordAccessTokenProvider()));

    provider.setClientTokenServices(clientTokenServices);
    template.setAccessTokenProvider(provider);

    return template;
}
 
开发者ID:PacktPublishing,项目名称:OAuth-2.0-Cookbook,代码行数:17,代码来源:ClientConfiguration.java

示例8: userAccessTokenProvider

import org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordAccessTokenProvider; //导入依赖的package包/类
public AccessTokenProvider userAccessTokenProvider() {
	ResourceOwnerPasswordAccessTokenProvider accessTokenProvider = new ResourceOwnerPasswordAccessTokenProvider();
	return accessTokenProvider;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:5,代码来源:ManualOAuthAuthenticationProvider.java

示例9: accessTokenProvider

import org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordAccessTokenProvider; //导入依赖的package包/类
@Bean
AccessTokenProvider accessTokenProvider() {
    ResourceOwnerPasswordAccessTokenProvider tokenProvider = new ResourceOwnerPasswordAccessTokenProvider();
    return tokenProvider;
}
 
开发者ID:sys-devel-d,项目名称:pimp,代码行数:6,代码来源:OAuthConfig.java

示例10: setupAccessTokenProvider

import org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordAccessTokenProvider; //导入依赖的package包/类
@BeforeOAuth2Context
public void setupAccessTokenProvider() {
        ResourceOwnerPasswordAccessTokenProvider accessTokenProvider = helper.createAccessTokenProvider();
        context.setAccessTokenProvider(accessTokenProvider);
}
 
开发者ID:ishaigor,项目名称:rest-retro-sample,代码行数:6,代码来源:IntegrationTest.java


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