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

Java IndirectClient类代码示例

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

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



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

示例1: testCallback

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Test
public void testCallback() throws Exception {
    final String originalSessionId = request.getSession().getId();
    request.setParameter(Clients.DEFAULT_CLIENT_NAME_PARAMETER, NAME);
    final CommonProfile profile = new CommonProfile();
    final IndirectClient indirectClient = new MockIndirectClient(NAME, null, new MockCredentials(), profile);
    config.setClients(new Clients(CALLBACK_URL, indirectClient));
    call();
    final HttpSession session = request.getSession();
    final String newSessionId = session.getId();
    final LinkedHashMap<String, CommonProfile> profiles = (LinkedHashMap<String, CommonProfile>) session.getAttribute(Pac4jConstants.USER_PROFILES);
    assertTrue(profiles.containsValue(profile));
    assertEquals(1, profiles.size());
    assertNotEquals(newSessionId, originalSessionId);
    assertEquals(302, response.getStatus());
    assertEquals(Pac4jConstants.DEFAULT_URL_VALUE, response.getRedirectedUrl());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:18,代码来源:J2ERenewSessionCallbackLogicTests.java


示例2: testCallbackWithOriginallyRequestedUrl

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Test
public void testCallbackWithOriginallyRequestedUrl() throws Exception {
    HttpSession session = request.getSession();
    final String originalSessionId = session.getId();
    session.setAttribute(Pac4jConstants.REQUESTED_URL, PAC4J_URL);
    request.setParameter(Clients.DEFAULT_CLIENT_NAME_PARAMETER, NAME);
    final CommonProfile profile = new CommonProfile();
    final IndirectClient indirectClient = new MockIndirectClient(NAME, null, new MockCredentials(), profile);
    config.setClients(new Clients(CALLBACK_URL, indirectClient));
    call();
    session = request.getSession();
    final String newSessionId = session.getId();
    final LinkedHashMap<String, CommonProfile> profiles = (LinkedHashMap<String, CommonProfile>) session.getAttribute(Pac4jConstants.USER_PROFILES);
    assertTrue(profiles.containsValue(profile));
    assertEquals(1, profiles.size());
    assertNotEquals(newSessionId, originalSessionId);
    assertEquals(302, response.getStatus());
    assertEquals(PAC4J_URL, response.getRedirectedUrl());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:20,代码来源:J2ERenewSessionCallbackLogicTests.java


示例3: testCallbackNoRenew

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Test
public void testCallbackNoRenew() throws Exception {
    final String originalSessionId = request.getSession().getId();
    request.setParameter(Clients.DEFAULT_CLIENT_NAME_PARAMETER, NAME);
    final CommonProfile profile = new CommonProfile();
    final IndirectClient indirectClient = new MockIndirectClient(NAME, null, new MockCredentials(), profile);
    config.setClients(new Clients(CALLBACK_URL, indirectClient));
    renewSession = false;
    call();
    final HttpSession session = request.getSession();
    final String newSessionId = session.getId();
    final LinkedHashMap<String, CommonProfile> profiles = (LinkedHashMap<String, CommonProfile>) session.getAttribute(Pac4jConstants.USER_PROFILES);
    assertTrue(profiles.containsValue(profile));
    assertEquals(1, profiles.size());
    assertEquals(newSessionId, originalSessionId);
    assertEquals(302, response.getStatus());
    assertEquals(Pac4jConstants.DEFAULT_URL_VALUE, response.getRedirectedUrl());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:19,代码来源:J2ERenewSessionCallbackLogicTests.java


示例4: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final OidcConfiguration configuration = new OidcConfiguration();
    configuration.setClientId("ZuxDX1Gw2Kvx4gFyDNWC");
    configuration.setSecret("77kjmDs94pA4UOVkeuYY7XyHnsDmSWoezrc3XZFU");
    configuration.setDiscoveryURI("https://dev-425954.oktapreview.com/.well-known/openid-configuration");
    final OidcClient client = new OidcClient(configuration);
    client.setCallbackUrl(PAC4J_URL);
    return client;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:11,代码来源:RunOkta.java


示例5: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final OidcConfiguration configuration = new OidcConfiguration();
    configuration.setClientId("test");
    configuration.setSecret("secret");
    configuration.setDiscoveryURI("http://localhost:1941/.well-known/openid-configuration");
    if (flow == Flow.IMPLICIT_FLOW) {
        // AllowedGrantTypes = GrantTypes.ImplicitAndClientCredentials,
        configuration.setResponseType("id_token");
        configuration.setResponseMode("form_post");
        configuration.setUseNonce(true);
        logger.warn("For the implicit flow, copy / paste the form body parameters after a ? as the returned url");
    } else if (flow == Flow.IMPLICIT_FLOW_CLIENT_SIDE) { // this flow can not be used in fact (as data ae passed as anchor parameters, only on client side)
        // AllowedGrantTypes = GrantTypes.ImplicitAndClientCredentials,
        configuration.setResponseType("id_token");
        configuration.setUseNonce(true);
    /*} else if (flow == Flow.AUTHORIZATION_CODE) {
        AllowedGrantTypes = GrantTypes.CodeAndClientCredentials,*/
    } else if (flow == Flow.HYBRID_FLOW) {
        // AllowAccessTokensViaBrowser = true, AllowedGrantTypes = GrantTypes.HybridAndClientCredentials,
        configuration.setResponseType("code id_token token");
        configuration.setUseNonce(true);
    } else if (flow != Flow.AUTHORIZATION_CODE) {
        throw new TechnicalException("Unsupported flow for tests");
    }
    final OidcClient client = new OidcClient(configuration);
    client.setCallbackUrl(PAC4J_BASE_URL);
    return client;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:30,代码来源:RunIdentityServer4.java


示例6: prepareForLoginPage

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
/**
 * Prepare the data for the login page.
 *
 * @param context The current webflow context
 */
protected void prepareForLoginPage(final RequestContext context) {
    final HttpServletRequest request = WebUtils.getHttpServletRequest(context);
    final HttpServletResponse response = WebUtils.getHttpServletResponse(context);
    final HttpSession session = request.getSession();

    // web context
    final WebContext webContext = new J2EContext(request, response);

    // save parameters in web session
    final WebApplicationService service = WebUtils.getService(context);
    logger.debug("save service: {}", service);
    session.setAttribute(CasProtocolConstants.PARAMETER_SERVICE, service);
    saveRequestParameter(request, session, ThemeChangeInterceptor.DEFAULT_PARAM_NAME);
    saveRequestParameter(request, session, LocaleChangeInterceptor.DEFAULT_PARAM_NAME);
    saveRequestParameter(request, session, CasProtocolConstants.PARAMETER_METHOD);

    final LinkedHashMap<String, String> urls = new LinkedHashMap<>();
    // for all clients, generate redirection urls
    for (final Client client : this.clients.findAllClients()) {
        final IndirectClient indirectClient = (IndirectClient) client;
        // clean Client suffix for default names
        final String name = client.getName().replace("Client", "");
        final String redirectionUrl = indirectClient.getRedirectionUrl(webContext);
        logger.debug("{} -> {}", name, redirectionUrl);
        urls.put(name, redirectionUrl);
    }
    context.getFlowScope().put(PAC4J_URLS, urls);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:34,代码来源:ClientAction.java


示例7: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final OidcConfiguration configuration = new OidcConfiguration();
    configuration.setClientId("682158564078-ndcjc83kp5v7vudikqu1fudtkcs2odeb.apps.googleusercontent.com");
    configuration.setSecret("gLB2U7LPYBFTxqYtyG81AhLH");
    final GoogleOidcClient client = new GoogleOidcClient(configuration);
    client.setCallbackUrl(PAC4J_BASE_URL);
    return client;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:10,代码来源:RunGoogleOidcClient.java


示例8: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final OidcConfiguration configuration = new OidcConfiguration();
    configuration.setClientId("acdf79d7-0129-4ba3-bc61-a52486cf82ff");
    configuration.setSecret("ALhlPK5ONNGojjZvEiIgyNEUfX1MbAlDXT1dM0-pVQSa-IID5QMq-lEhlawRqejPZ8c70LBqfKyFL79tefmPb7k");
    configuration.setDiscoveryURI("https://mitreid.org/.well-known/openid-configuration");
    configuration.setPreferredJwsAlgorithm(JWSAlgorithm.parse("none"));
    final OidcClient client = new OidcClient(configuration);
    client.setCallbackUrl(PAC4J_URL);
    return client;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:12,代码来源:RunMitreIdOrg.java


示例9: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final OidcConfiguration configuration = new OidcConfiguration();
    configuration.setClientId("788339d7-1c44-4732-97c9-134cb201f01f");
    configuration.setSecret("we/31zi+JYa7zOugO4TbSw0hzn+hv2wmENO9AS3T84s=");
    configuration.setDiscoveryURI("https://login.microsoftonline.com/38c46e5a-21f0-46e5-940d-3ca06fd1a330/.well-known/openid-configuration");
    final AzureAdClient client = new AzureAdClient(configuration);
    client.setCallbackUrl(PAC4J_URL);
    //client.setCallbackUrl(CommonHelper.addParameter(PAC4J_URL, Clients.DEFAULT_CLIENT_NAME_PARAMETER, client.getName()));
    return client;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:12,代码来源:RunAzureAdClient.java


示例10: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final OidcConfiguration configuration = new OidcConfiguration();
    configuration.setClientId(CLIENT_ID);
    configuration.setSecret("secret");
    //configuration.setDiscoveryURI("https://casserverpac4j.herokuapp.com/oidc/.well-known/openid-configuration");
    configuration.setDiscoveryURI("http://localhost:8888/cas/oidc/.well-known/openid-configuration");
    final OidcClient client = new OidcClient(configuration);
    client.setCallbackUrl(PAC4J_BASE_URL);
    return client;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:12,代码来源:RunCasOidcWrapper.java


示例11: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final SAML2ClientConfiguration cfg = new SAML2ClientConfiguration("resource:samlKeystore.jks", "pac4j-demo-passwd", "pac4j-demo-passwd", "resource:testshib-providers.xml");
    cfg.setMaximumAuthenticationLifetime(3600);
    cfg.setServiceProviderEntityId("urn:mace:saml:pac4j.org");
    cfg.setServiceProviderMetadataPath(new File("target", "sp-metadata.xml").getAbsolutePath());
    cfg.setDestinationBindingType(SAMLConstants.SAML2_REDIRECT_BINDING_URI);
    final SAML2Client client = new SAML2Client(cfg);
    client.setCallbackUrl(PAC4J_URL);
    return client;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:12,代码来源:RunTestshib.java


示例12: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final StravaClient stravaClient = new StravaClient();
    stravaClient.setApprovalPrompt("force");
    stravaClient.setKey("3945");
    stravaClient.setSecret("f03df80582396cddfbe0b895a726bac27c8cf739");
    stravaClient.setCallbackUrl(PAC4J_BASE_URL);
    stravaClient.setScope("view_private");
    return stravaClient;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:11,代码来源:RunStravaClient.java


示例13: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final WindowsLiveClient liveClient = new WindowsLiveClient();
    liveClient.setKey("00000000400BFE75");
    liveClient.setSecret("9yz0WtTIUQVV7HhBV2tccTziETOt4pRG");
    liveClient.setCallbackUrl(PAC4J_URL);
    return liveClient;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:9,代码来源:RunWindowsLiveClient.java


示例14: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final QQClient qqClient = new QQClient();
    qqClient.setKey("3nJPbVTVRZWAyUgoUKQ8UA");
    qqClient.setSecret("h6LZyZJmcW46Vu8R47MYfeXTSYGI30EqnWaSwVhFkbA");
    qqClient.setCallbackUrl(PAC4J_URL);
    return qqClient;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:9,代码来源:RunQQClient.java


示例15: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final OrcidClient client = new OrcidClient();
    client.setKey("APP-IVZK2KU3UNHH2AH0");
    client.setSecret("852f8210-ff83-45ff-9a04-a52a39b41abd");
    client.setCallbackUrl(PAC4J_URL);
    return client;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:9,代码来源:RunOrcidClient.java


示例16: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final Google2Client google2Client = new Google2Client();
    google2Client.setKey("682158564078-ndcjc83kp5v7vudikqu1fudtkcs2odeb.apps.googleusercontent.com");
    google2Client.setSecret("gLB2U7LPYBFTxqYtyG81AhLH");
    google2Client.setCallbackUrl(PAC4J_BASE_URL);
    google2Client.setScope(Google2Client.Google2Scope.EMAIL_AND_PROFILE);
    return google2Client;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:10,代码来源:RunGoogle2Client.java


示例17: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final WordPressClient wordPressClient = new WordPressClient();
    wordPressClient.setKey("209");
    wordPressClient.setSecret("xJBXMRVvKrvHqyvM6BpzkenJVMIdQrIWKjPJsezjGYu71y7sDgt8ibz6s9IFLqU8");
    wordPressClient.setCallbackUrl(PAC4J_URL);
    return wordPressClient;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:9,代码来源:RunWordPressClient.java


示例18: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final DropBoxClient dropBoxClient = new DropBoxClient();
    dropBoxClient.setKey("0194c6m79qll0ia");
    dropBoxClient.setSecret("a0ylze9a0bhsvxv");
    dropBoxClient.setCallbackUrl("https://www.google.com");
    return dropBoxClient;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:9,代码来源:RunDropboxClient.java


示例19: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final GenericOAuth20StateClient client = new GenericOAuth20StateClient();
    client.setAttributesDefinition(new Google2AttributesDefinition());
    client.setAuthUrl("https://accounts.google.com/o/oauth2/auth");
    client.setTokenUrl("https://accounts.google.com/o/oauth2/token");
    client.setProfileUrl("https://www.googleapis.com/plus/v1/people/me");
    client.setKey("682158564078-ndcjc83kp5v7vudikqu1fudtkcs2odeb.apps.googleusercontent.com");
    client.setSecret("gLB2U7LPYBFTxqYtyG81AhLH");
    client.setCallbackUrl(PAC4J_BASE_URL);
    client.setScope("profile email");
    return client;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:14,代码来源:RunGeneric20StateClient.java


示例20: getClient

import org.pac4j.core.client.IndirectClient; //导入依赖的package包/类
@Override
protected IndirectClient getClient() {
    final FacebookClient facebookClient = new FacebookClient();
    facebookClient.setKey("1002857006444390");
    facebookClient.setSecret("c352c9668493d3f9ac3f0fa71f04c187");
    facebookClient.setCallbackUrl(PAC4J_URL);
    facebookClient
            .setScope("email,user_about_me,user_actions.books,user_actions.fitness,user_actions.music,user_actions.news,user_actions.video,user_birthday,user_education_history,user_events,user_friends,user_games_activity,user_hometown,user_likes,user_location,user_managed_groups,user_photos,user_posts,user_relationship_details,user_relationships,user_religion_politics,user_status,user_tagged_places,user_videos,user_website,user_work_history");
    facebookClient.setFields(FacebookClient.DEFAULT_FIELDS
            + ",friends,movies,music,books,likes,albums,events,groups,music.listens,picture");
    facebookClient.setLimit(100);
    return facebookClient;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:14,代码来源:RunFacebookClient.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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