本文整理汇总了Java中org.pac4j.core.client.IndirectClient类的典型用法代码示例。如果您正苦于以下问题:Java IndirectClient类的具体用法?Java IndirectClient怎么用?Java IndirectClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IndirectClient类属于org.pac4j.core.client包,在下文中一共展示了IndirectClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例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());
}
示例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());
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}