• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ClientIdentifier类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createFlow

import org.glassfish.jersey.client.oauth2.ClientIdentifier; //导入依赖的package包/类
private void createFlow(final String redirectUri, final Set<String> scopes, final String state) {
    final String scopesString = getScopesString(scopes);
    final ClientIdentifier clientIdentifier = new ClientIdentifier(clientId, clientSecret);
    @SuppressWarnings("rawtypes")
    final OAuth2CodeGrantFlow.Builder builder = OAuth2ClientSupport.authorizationCodeGrantFlowBuilder(
            clientIdentifier, URI_AUTHENTICATION, URI_ACCESS_TOKEN);
    if (StringUtils.isNotBlank(redirectUri)) {
        builder.redirectUri(redirectUri);
    }
    if (StringUtils.isNotBlank(state)) {
        builder.property(OAuth2CodeGrantFlow.Phase.AUTHORIZATION, "state", state);
    }
    if (StringUtils.isNotBlank(scopesString)) {
        builder.scope(scopesString);
    }
    oAuthFlow = builder.build();
}
 
开发者ID:burberius,项目名称:eve-esi,代码行数:18,代码来源:OAuth.java


示例2: OAuthConfiguration

import org.glassfish.jersey.client.oauth2.ClientIdentifier; //导入依赖的package包/类
/**
 * @param clientIdentifier OAuth client identifier object
 * @param oauthServiceAuthenticationClient OAuth service authenticator for contacting authentication service in
 *            three-legged OAuth
 * @param authorisationUri The URL to which the OAuth 2.0 authorisation code request will be made to
 * @param accessTokenUri The URL to which the OAuth 2.0 access token request will be made to
 * @param redirectUri The URL to which the OAuth 2.0 server will expect to redirect to
 * @param refreshTokenUri The URL to which the OAuth 2.0 refresh token request will be made to
 */
public OAuthConfiguration(final ClientIdentifier clientIdentifier,
        final OAuthUserAgent serviceAuthenticationClient, final String authorisationUri,
        final String accessTokenUri, final String redirectUri, final String refreshTokenUri) {
    this.clientIdentifier = clientIdentifier;
    this.serviceAuthenticationClient = serviceAuthenticationClient;
    this.authorisationUri = authorisationUri;
    this.accessTokenUri = accessTokenUri;
    this.redirectUri = redirectUri;
    this.refreshTokenUri = refreshTokenUri;
}
 
开发者ID:travel-cloud,项目名称:Cheddar,代码行数:20,代码来源:OAuthConfiguration.java


示例3: authorize

import org.glassfish.jersey.client.oauth2.ClientIdentifier; //导入依赖的package包/类
@GET
@Path("/authorize")
@JiveSignatureValidation
public Response authorize(@Context HttpServletRequest request, @Context UriInfo uriInfo) {

    String instanceID = "TODO"; //TODO: HEADER PARAM / QUERY PARAM
    String userID = "TODO";     //TODO: HEADER PARAM / QUERY PARAM

    //TODO: PARAMETERIZE
    ClientIdentifier clientIdentifier = new ClientIdentifier(serviceConfig.getClientID(),serviceConfig.getClientSecret());
    OAuth2CodeGrantFlow flow = OAuth2ClientSupport
            .facebookFlowBuilder(clientIdentifier,uriInfo.getBaseUri() + "oauth2/"+SERVICE_NAME+"/callback")
            .scope(serviceConfig.getScope()).build();

    String authorizationUrl = flow.start();

    try {
        URI authorizationUri = new URI(authorizationUrl);

        /** LOAD INTO SESSION FOR FOLLOW-UP HIT **/
        request.getSession().setAttribute(getFlowSessionKey(),flow);
        request.getSession().setAttribute(getInstanceIDSessionKey(),instanceID);
        request.getSession().setAttribute(getUserIDSessionKey(),userID);

        //*** NOTE: 303 "See Other" NEEDED FOR JERSEY FLOW TO PICK UP
        return Response.seeOther(authorizationUri).build();
    } catch (URISyntaxException use) {
        log.error("Invalid Authorization URI: "+authorizationUrl);
        return Response.serverError().entity("Unable to Process this Request").build();
    } // end try/catch

}
 
开发者ID:jivesoftware,项目名称:jive-sdk-java-jersey,代码行数:33,代码来源:FacebookOAuth2Service.java


示例4: authorize

import org.glassfish.jersey.client.oauth2.ClientIdentifier; //导入依赖的package包/类
@GET
@Path("/authorize")
public Response authorize(@Context HttpServletRequest request, @Context UriInfo uriInfo) {

    String userID = "TODO";     //TODO: HEADER/QUERY - PARAM
    String instanceID = "TODO"; //TODO: HEADER/QUERY - PARAM

    ClientIdentifier clientID = new ClientIdentifier(serviceConfig.getClientID(),serviceConfig.getClientSecret());
    OAuth2CodeGrantFlow flow = OAuth2ClientSupport.authorizationCodeGrantFlowBuilder(
            clientID,
            serviceConfig.getAuthorizeUrl(),
            serviceConfig.getTokenUrl()
        ).scope(serviceConfig.getScope())
        .redirectUri(uriInfo.getBaseUri() + "oauth2/callback")
        .build();

    String authorizationUrl = flow.start();

    try {
        URI authorizationUri = new URI(authorizationUrl);

        /** LOAD INTO SESSION FOR FOLLOW-UP HIT **/
        request.getSession().setAttribute(getFlowSessionKey(),flow);
        request.getSession().setAttribute(getInstanceIDSessionKey(),instanceID);
        request.getSession().setAttribute(getUserIDSessionKey(),userID);

        //*** NOTE: 303 "See Other" NEEDED FOR JERSEY FLOW TO PICK UP
        return Response.seeOther(new URI(authorizationUrl)).build();
    } catch (URISyntaxException use) {
        log.error("Invalid Authorization URI: "+authorizationUrl);
        return Response.serverError().entity("Unable to Process this Request").build();
    } // end try/catch

}
 
开发者ID:jivesoftware,项目名称:jive-sdk-java-jersey,代码行数:35,代码来源:JiveOAuth2Service.java


示例5: authorize

import org.glassfish.jersey.client.oauth2.ClientIdentifier; //导入依赖的package包/类
@GET
@Path("/authorize")
@JiveSignatureValidation
public Response authorize(@Context HttpServletRequest request, @Context UriInfo uriInfo) {

    String instanceID = "TODO"; //TODO: HEADER PARAM / QUERY PARAM
    String userID = "TODO";     //TODO: HEADER PARAM / QUERY PARAM

    ClientIdentifier clientIdentifier = new ClientIdentifier(serviceConfig.getClientID(),serviceConfig.getClientSecret());
    OAuth2CodeGrantFlow flow = OAuth2ClientSupport
        .googleFlowBuilder(clientIdentifier, uriInfo.getBaseUri() + "oauth2/" + SERVICE_NAME + "/callback", serviceConfig.getScope())
        .build();

    String authorizationUrl = flow.start();

    try {
        URI authorizationUri = new URI(authorizationUrl);

        /** LOAD INTO SESSION FOR FOLLOW-UP HIT **/
        request.getSession().setAttribute(getFlowSessionKey(),flow);
        request.getSession().setAttribute(getInstanceIDSessionKey(),instanceID);
        request.getSession().setAttribute(getUserIDSessionKey(),userID);

        //*** NOTE: 303 "See Other" NEEDED FOR JERSEY FLOW TO PICK UP
        return Response.seeOther(authorizationUri).build();
    } catch (URISyntaxException use) {
        log.error("Invalid Authorization URI: "+authorizationUrl);
        return Response.serverError().entity("Unable to Process this Request").build();
    } // end try/catch

}
 
开发者ID:jivesoftware,项目名称:jive-sdk-java-jersey,代码行数:32,代码来源:GoogleOAuth2Service.java


示例6: simpleResourceTest

import org.glassfish.jersey.client.oauth2.ClientIdentifier; //导入依赖的package包/类
@Test
public void simpleResourceTest() throws UnsupportedEncodingException
{
	
	ClientIdentifier cliendId = new ClientIdentifier(clientEntity.getClientId(), clientEntity.getClientSecret());
	
	Builder<?> flowBuilder = OAuth2ClientSupport.authorizationCodeGrantFlowBuilder(cliendId, "http://localhost:9998/testsuite/oauth2/auth", "http://localhost:9998/testsuite/oauth2/accessToken");
	OAuth2CodeGrantFlow flow = flowBuilder.scope("test1 test2").redirectUri("http://localhost:9998/testsuite").build();
	String authUrl = flow.start();
	
	Map<String, String> map = retrieveCode(authUrl);
	String code = map.get("code");
	String state = map.get("state"); 
	
	TokenResult tokenResult = flow.finish(code, state);

	client = ClientBuilder.newClient();
	client.register(LoggingFilter.class);
	client.register(OAuth2ClientSupport.feature(tokenResult.getAccessToken()));
	client.register(JacksonFeature.class);
	Invocation.Builder builder = client.target("http://localhost:9998/testsuite/rest/sample/1").request();
	Response response = builder.get();
	
	assertEquals(200, response.getStatus());
	SampleEntity entity = response.readEntity(SampleEntity.class);
	assertNotNull(entity);
}
 
开发者ID:hburgmeier,项目名称:jerseyoauth2,代码行数:28,代码来源:Jersey2Test.java


示例7: clientIdentifier

import org.glassfish.jersey.client.oauth2.ClientIdentifier; //导入依赖的package包/类
public ClientIdentifier clientIdentifier() {
    return clientIdentifier;
}
 
开发者ID:travel-cloud,项目名称:Cheddar,代码行数:4,代码来源:OAuthConfiguration.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SyntaxException类代码示例发布时间:2022-05-15
下一篇:
Java Log类代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap