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


Java TwitterClient类代码示例

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


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

示例1: verifyStartAuthentication

import org.pac4j.oauth.client.TwitterClient; //导入依赖的package包/类
@Test
public void verifyStartAuthentication() throws Exception {
    final MockHttpServletRequest mockRequest = new MockHttpServletRequest();
    mockRequest.setParameter(ThemeChangeInterceptor.DEFAULT_PARAM_NAME, MY_THEME);
    mockRequest.setParameter(LocaleChangeInterceptor.DEFAULT_PARAM_NAME, MY_LOCALE);
    mockRequest.setParameter(CasProtocolConstants.PARAMETER_METHOD, MY_METHOD);

    final MockHttpSession mockSession = new MockHttpSession();
    mockRequest.setSession(mockSession);

    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(servletExternalContext.getNativeRequest()).thenReturn(mockRequest);

    final MockRequestContext mockRequestContext = new MockRequestContext();
    mockRequestContext.setExternalContext(servletExternalContext);
    mockRequestContext.getFlowScope().put(CasProtocolConstants.PARAMETER_SERVICE,
            org.jasig.cas.services.TestUtils.getService(MY_SERVICE));

    final FacebookClient facebookClient = new FacebookClient(MY_KEY, MY_SECRET);
    final TwitterClient twitterClient = new TwitterClient(MY_KEY, MY_SECRET);
    final Clients clients = new Clients(MY_LOGIN_URL, facebookClient, twitterClient);
    final ClientAction action = new ClientAction();
    action.setCentralAuthenticationService(mock(CentralAuthenticationService.class));
    action.setClients(clients);

    final Event event = action.execute(mockRequestContext);
    assertEquals("error", event.getId());
    assertEquals(MY_THEME, mockSession.getAttribute(ThemeChangeInterceptor.DEFAULT_PARAM_NAME));
    assertEquals(MY_LOCALE, mockSession.getAttribute(LocaleChangeInterceptor.DEFAULT_PARAM_NAME));
    assertEquals(MY_METHOD, mockSession.getAttribute(CasProtocolConstants.PARAMETER_METHOD));
    final MutableAttributeMap flowScope = mockRequestContext.getFlowScope();
    final Map<String, String> urls = (Map<String, String>) flowScope.get(ClientAction.PAC4J_URLS);
    assertTrue((urls.get("Facebook"))
            .startsWith("https://www.facebook.com/v2.2/dialog/oauth?client_id=my_key&redirect_uri=http%3A%2F%2Fcasserver%2Flogin%3F"
                    + Clients.DEFAULT_CLIENT_NAME_PARAMETER + "%3DFacebookClient&state="));
    assertEquals(MY_LOGIN_URL + '?' + Clients.DEFAULT_CLIENT_NAME_PARAMETER
            + "=TwitterClient&needs_client_redirection=true", urls.get("Twitter"));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:39,代码来源:ClientActionTests.java

示例2: verifyStartAuthentication

import org.pac4j.oauth.client.TwitterClient; //导入依赖的package包/类
@Test
public void verifyStartAuthentication() throws Exception {
    final MockHttpServletRequest mockRequest = new MockHttpServletRequest();
    mockRequest.setParameter(ClientAction.THEME, MY_THEME);
    mockRequest.setParameter(ClientAction.LOCALE, MY_LOCALE);
    mockRequest.setParameter(ClientAction.METHOD, MY_METHOD);

    final MockHttpSession mockSession = new MockHttpSession();
    mockRequest.setSession(mockSession);

    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(servletExternalContext.getNativeRequest()).thenReturn(mockRequest);

    final MockRequestContext mockRequestContext = new MockRequestContext();
    mockRequestContext.setExternalContext(servletExternalContext);
    mockRequestContext.getFlowScope().put(ClientAction.SERVICE, new SimpleWebApplicationServiceImpl(MY_SERVICE));

    final FacebookClient facebookClient = new FacebookClient(MY_KEY, MY_SECRET);
    final TwitterClient twitterClient = new TwitterClient(MY_KEY, MY_SECRET);
    final Clients clients = new Clients(MY_LOGIN_URL, facebookClient, twitterClient);
    final ClientAction action = new ClientAction(mock(CentralAuthenticationService.class), clients);

    final Event event = action.execute(mockRequestContext);
    assertEquals("error", event.getId());
    assertEquals(MY_THEME, mockSession.getAttribute(ClientAction.THEME));
    assertEquals(MY_LOCALE, mockSession.getAttribute(ClientAction.LOCALE));
    assertEquals(MY_METHOD, mockSession.getAttribute(ClientAction.METHOD));
    final MutableAttributeMap flowScope = mockRequestContext.getFlowScope();
    assertTrue(((String) flowScope.get("FacebookClientUrl"))
            .startsWith("https://www.facebook.com/v2.2/dialog/oauth?client_id=my_key&redirect_uri=http%3A%2F%2Fcasserver%2Flogin%3F"
                    + Clients.DEFAULT_CLIENT_NAME_PARAMETER + "%3DFacebookClient&state="));
    assertEquals(MY_LOGIN_URL + "?" + Clients.DEFAULT_CLIENT_NAME_PARAMETER
            + "=TwitterClient&needs_client_redirection=true", flowScope.get("TwitterClientUrl"));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:35,代码来源:ClientActionTests.java

示例3: configureTwitterClient

import org.pac4j.oauth.client.TwitterClient; //导入依赖的package包/类
private void configureTwitterClient(final Collection<BaseClient> properties) {
    final Pac4jProperties.Twitter twitter = casProperties.getAuthn().getPac4j().getTwitter();
    if (StringUtils.isNotBlank(twitter.getId()) && StringUtils.isNotBlank(twitter.getSecret())) {
        final TwitterClient client = new TwitterClient(twitter.getId(), twitter.getSecret());
        LOGGER.debug("Created client [{}] with identifier [{}]", client.getName(), client.getKey());
        properties.add(client);
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:9,代码来源:Pac4jAuthenticationEventExecutionPlanConfiguration.java

示例4: verifyStartAuthentication

import org.pac4j.oauth.client.TwitterClient; //导入依赖的package包/类
@Test
public void verifyStartAuthentication() throws Exception {
    final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
    final MockHttpServletRequest mockRequest = new MockHttpServletRequest();
    mockRequest.setParameter(ThemeChangeInterceptor.DEFAULT_PARAM_NAME, MY_THEME);
    mockRequest.setParameter(LocaleChangeInterceptor.DEFAULT_PARAM_NAME, MY_LOCALE);
    mockRequest.setParameter(CasProtocolConstants.PARAMETER_METHOD, MY_METHOD);

    final MockHttpSession mockSession = new MockHttpSession();
    mockRequest.setSession(mockSession);

    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(servletExternalContext.getNativeRequest()).thenReturn(mockRequest);
    when(servletExternalContext.getNativeResponse()).thenReturn(mockResponse);

    final MockRequestContext mockRequestContext = new MockRequestContext();
    mockRequestContext.setExternalContext(servletExternalContext);
    mockRequestContext.getFlowScope().put(CasProtocolConstants.PARAMETER_SERVICE,
            RegisteredServiceTestUtils.getService(MY_SERVICE));

    final FacebookClient facebookClient = new FacebookClient(MY_KEY, MY_SECRET);
    final TwitterClient twitterClient = new TwitterClient("3nJPbVTVRZWAyUgoUKQ8UA", "h6LZyZJmcW46Vu8R47MYfeXTSYGI30EqnWaSwVhFkbA");
    final Clients clients = new Clients(MY_LOGIN_URL, facebookClient, twitterClient);
    final DelegatedClientAuthenticationAction action = new DelegatedClientAuthenticationAction(clients,
            null, mock(CentralAuthenticationService.class),
            "theme", "locale", false);

    final Event event = action.execute(mockRequestContext);
    assertEquals("error", event.getId());
    assertEquals(MY_THEME, mockSession.getAttribute(ThemeChangeInterceptor.DEFAULT_PARAM_NAME));
    assertEquals(MY_LOCALE, mockSession.getAttribute(LocaleChangeInterceptor.DEFAULT_PARAM_NAME));
    assertEquals(MY_METHOD, mockSession.getAttribute(CasProtocolConstants.PARAMETER_METHOD));
    final MutableAttributeMap flowScope = mockRequestContext.getFlowScope();
    final Set<DelegatedClientAuthenticationAction.ProviderLoginPageConfiguration> urls =
            (Set<DelegatedClientAuthenticationAction.ProviderLoginPageConfiguration>) flowScope.get(DelegatedClientAuthenticationAction.PAC4J_URLS);

    assertFalse(urls.isEmpty());
    assertSame(2, urls.size());
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:40,代码来源:DelegatedClientAuthenticationActionTests.java

示例5: testStartAuthentication

import org.pac4j.oauth.client.TwitterClient; //导入依赖的package包/类
@Test
public void testStartAuthentication() throws Exception {
    final MockHttpServletRequest mockRequest = new MockHttpServletRequest();
    mockRequest.setParameter(ClientAction.THEME, MY_THEME);
    mockRequest.setParameter(ClientAction.LOCALE, MY_LOCALE);
    mockRequest.setParameter(ClientAction.METHOD, MY_METHOD);

    final MockHttpSession mockSession = new MockHttpSession();
    mockRequest.setSession(mockSession);

    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(servletExternalContext.getNativeRequest()).thenReturn(mockRequest);

    final MockRequestContext mockRequestContext = new MockRequestContext();
    mockRequestContext.setExternalContext(servletExternalContext);
    mockRequestContext.getFlowScope().put(ClientAction.SERVICE, new SimpleWebApplicationServiceImpl(MY_SERVICE));

    final FacebookClient facebookClient = new FacebookClient(MY_KEY, MY_SECRET);
    final TwitterClient twitterClient = new TwitterClient(MY_KEY, MY_SECRET);
    final Clients clients = new Clients(MY_LOGIN_URL, facebookClient, twitterClient);
    final ClientAction action = new ClientAction(mock(CentralAuthenticationService.class), clients);

    final Event event = action.execute(mockRequestContext);
    assertEquals("error", event.getId());
    assertEquals(MY_THEME, mockSession.getAttribute(ClientAction.THEME));
    assertEquals(MY_LOCALE, mockSession.getAttribute(ClientAction.LOCALE));
    assertEquals(MY_METHOD, mockSession.getAttribute(ClientAction.METHOD));
    final MutableAttributeMap flowScope = mockRequestContext.getFlowScope();
    assertTrue(((String) flowScope.get("FacebookClientUrl"))
            .startsWith("https://www.facebook.com/v2.2/dialog/oauth?client_id=my_key&redirect_uri=http%3A%2F%2Fcasserver%2Flogin%3F"
                    + Clients.DEFAULT_CLIENT_NAME_PARAMETER + "%3DFacebookClient&state="));
    assertEquals(MY_LOGIN_URL + "?" + Clients.DEFAULT_CLIENT_NAME_PARAMETER
            + "=TwitterClient&needs_client_redirection=true", flowScope.get("TwitterClientUrl"));
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:35,代码来源:ClientActionTests.java

示例6: tryCreateTwitterClient

import org.pac4j.oauth.client.TwitterClient; //导入依赖的package包/类
private void tryCreateTwitterClient(final List<Client> clients) {
    final String id = getProperty(TWITTER_ID);
    final String secret = getProperty(TWITTER_SECRET);
    if (CommonHelper.isNotBlank(id) && CommonHelper.isNotBlank(secret)) {
        final TwitterClient twitterClient = new TwitterClient(id, secret);
        clients.add(twitterClient);
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:9,代码来源:PropertiesConfigFactory.java

示例7: getClient

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

示例8: testStartAuthentication

import org.pac4j.oauth.client.TwitterClient; //导入依赖的package包/类
@Test
public void testStartAuthentication() throws Exception {
    final MockHttpServletRequest mockRequest = new MockHttpServletRequest();
    mockRequest.setParameter(ClientAction.THEME, MY_THEME);
    mockRequest.setParameter(ClientAction.LOCALE, MY_LOCALE);
    mockRequest.setParameter(ClientAction.METHOD, MY_METHOD);

    final MockHttpSession mockSession = new MockHttpSession();
    mockRequest.setSession(mockSession);

    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(servletExternalContext.getNativeRequest()).thenReturn(mockRequest);

    final MockRequestContext mockRequestContext = new MockRequestContext();
    mockRequestContext.setExternalContext(servletExternalContext);
    mockRequestContext.getFlowScope().put(ClientAction.SERVICE, new SimpleWebApplicationServiceImpl(MY_SERVICE));

    final FacebookClient facebookClient = new FacebookClient(MY_KEY, MY_SECRET);
    final TwitterClient twitterClient = new TwitterClient(MY_KEY, MY_SECRET);
    final Clients clients = new Clients(MY_LOGIN_URL, facebookClient, twitterClient);
    final ClientAction action = new ClientAction(mock(CentralAuthenticationService.class), clients);

    final Event event = action.execute(mockRequestContext);
    assertEquals("error", event.getId());
    assertEquals(MY_THEME, mockSession.getAttribute(ClientAction.THEME));
    assertEquals(MY_LOCALE, mockSession.getAttribute(ClientAction.LOCALE));
    assertEquals(MY_METHOD, mockSession.getAttribute(ClientAction.METHOD));
    final MutableAttributeMap flowScope = mockRequestContext.getFlowScope();
    assertTrue(((String) flowScope.get("FacebookClientUrl"))
            .startsWith("https://www.facebook.com/dialog/oauth?client_id=my_key&redirect_uri=http%3A%2F%2Fcasserver%2Flogin%3F"
                    + Clients.DEFAULT_CLIENT_NAME_PARAMETER + "%3DFacebookClient&state="));
    assertEquals(MY_LOGIN_URL + "?" + Clients.DEFAULT_CLIENT_NAME_PARAMETER
            + "=TwitterClient&needs_client_redirection=true", flowScope.get("TwitterClientUrl"));
}
 
开发者ID:kevin3061,项目名称:cas-4.0.1,代码行数:35,代码来源:ClientActionTests.java

示例9: pac4jMultiClientWith

import org.pac4j.oauth.client.TwitterClient; //导入依赖的package包/类
@Test
public void pac4jMultiClientWith() throws Exception {
  Config config = config("/");
  new MockUnit(Env.class, Binder.class, Router.class, WebContext.class, Registry.class,
      FacebookClient.class, TwitterClient.class)
      .expect(newClients("http://localhost:8080/callback"))
      .expect(pac4jConfig)
      .expect(sessionStore(null))
      .expect(profile(CommonProfile.class))
      .expect(profile(UserProfile.class))
      .expect(router)
      .expect(setClients(FacebookClient.class, TwitterClient.class))
      .expect(webContext)
      .expect(profileManager)
      .expect(profileManagerFactory(null))
      .expect(callback(null, "/", "/callback", true, false))
      .expect(securityLogic(null, "/**", "ProfileAuthorizer", null, true,
          Clients.DEFAULT_CLIENT_NAME_PARAMETER, ImmutableSet.of("/callback", "/**"),
          FacebookClient.class,
          TwitterClient.class))
      .expect(logoutLogic(null, "/", "/.*", true, true, false))
      .expect(guiceAuthorizers())
      .expect(setupGuiceAuthorizers())
      .expect(authorizer("ProfileAuthorizer", Pac4jAuthorizer.class))
      .expect(authorizer("ProfileAuthorizer", Pac4jAuthorizer.class))
      .run(unit -> {
        new Pac4j()
            .client("*", ProfileAuthorizer.class, conf -> {
              assertNotNull(conf);
              return unit.get(FacebookClient.class);
            })
            .client("*", ProfileAuthorizer.class, conf -> {
              assertNotNull(conf);
              return unit.get(TwitterClient.class);
            })
            .configure(unit.get(Env.class), config, unit.get(Binder.class));
      }, setupGuiceAuthorizers());
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:39,代码来源:Pac4jTest.java

示例10: twitterClient

import org.pac4j.oauth.client.TwitterClient; //导入依赖的package包/类
@Bean
public TwitterClient twitterClient() {
	final TwitterClient client = new TwitterClient(twitterKey, twitterSecret);
	client.setCallbackUrl(rootUrl + apiPath + OAUTH_CALLBACK_PATH_SUFFIX + "?client_name=TwitterClient");

	return client;
}
 
开发者ID:thm-projects,项目名称:arsnova-backend,代码行数:8,代码来源:SecurityConfig.java

示例11: test

import org.pac4j.oauth.client.TwitterClient; //导入依赖的package包/类
@Test
public void test() {
    final Map<String, String> properties = new HashMap<>();
    properties.put(FACEBOOK_ID, ID);
    properties.put(FACEBOOK_SECRET, SECRET);
    properties.put(TWITTER_ID, ID);
    properties.put(TWITTER_SECRET, SECRET);
    properties.put(CAS_LOGIN_URL, CALLBACK_URL);
    properties.put(CAS_PROTOCOL, CasProtocol.CAS20.toString());
    properties.put(SAML_KEYSTORE_PASSWORD, PASSWORD);
    properties.put(SAML_PRIVATE_KEY_PASSWORD, PASSWORD);
    properties.put(SAML_KEYSTORE_PATH, PATH);
    properties.put(SAML_IDENTITY_PROVIDER_METADATA_PATH, PATH);
    properties.put(SAML_DESTINATION_BINDING_TYPE, SAMLConstants.SAML2_REDIRECT_BINDING_URI);
    properties.put(OIDC_ID, ID);
    properties.put(OIDC_SECRET, SECRET);
    properties.put(OIDC_DISCOVERY_URI, CALLBACK_URL);
    properties.put(OIDC_USE_NONCE, "true");
    properties.put(OIDC_PREFERRED_JWS_ALGORITHM, "RS384");
    properties.put(OIDC_MAX_CLOCK_SKEW, "60");
    properties.put(OIDC_CLIENT_AUTHENTICATION_METHOD, "CLIENT_SECRET_POST");
    properties.put(OIDC_CUSTOM_PARAM_KEY1, KEY);
    properties.put(OIDC_CUSTOM_PARAM_VALUE1, VALUE);

    properties.put(CAS_LOGIN_URL.concat(".1"), CALLBACK_URL);
    properties.put(CAS_PROTOCOL.concat(".1"), CasProtocol.CAS30.toString());

    properties.put(OIDC_TYPE.concat(".1"), "google");
    properties.put(OIDC_ID.concat(".1"), ID);
    properties.put(OIDC_SECRET.concat(".1"), SECRET);

    final PropertiesConfigFactory factory = new PropertiesConfigFactory(CALLBACK_URL, properties);
    final Config config = factory.build();
    final Clients clients = config.getClients();
    assertEquals(7, clients.getClients().size());

    final FacebookClient fbClient = (FacebookClient) clients.findClient("FacebookClient");
    assertEquals(ID, fbClient.getKey());
    assertEquals(SECRET, fbClient.getSecret());

    final TwitterClient twClient = (TwitterClient) clients.findClient("TwitterClient");
    assertEquals(ID, twClient.getKey());
    assertEquals(SECRET, twClient.getSecret());

    final CasClient casClient = (CasClient) clients.findClient("CasClient");
    assertEquals(CALLBACK_URL, casClient.getConfiguration().getLoginUrl());
    assertEquals(CasProtocol.CAS20, casClient.getConfiguration().getProtocol());

    final SAML2Client saml2client = (SAML2Client) clients.findClient("SAML2Client");
    assertNotNull(saml2client);
    assertEquals(SAMLConstants.SAML2_REDIRECT_BINDING_URI, saml2client.getConfiguration().getDestinationBindingType());

    final OidcClient oidcClient = (OidcClient) clients.findClient("OidcClient");
    assertNotNull(oidcClient);
    assertEquals(ClientAuthenticationMethod.CLIENT_SECRET_POST.toString(), oidcClient.getConfiguration().getClientAuthenticationMethod().toString().toLowerCase());

    final CasClient casClient1 = (CasClient) clients.findClient("CasClient.1");
    assertEquals(CasProtocol.CAS30, casClient1.getConfiguration().getProtocol());

    final GoogleOidcClient googleOidcClient = (GoogleOidcClient) clients.findClient("GoogleOidcClient.1");
    googleOidcClient.init(MockWebContext.create());
    assertEquals(ID, googleOidcClient.getConfiguration().getClientId());
    assertEquals(SECRET, googleOidcClient.getConfiguration().getSecret());
    assertEquals("https://accounts.google.com/.well-known/openid-configuration", googleOidcClient.getConfiguration().getDiscoveryURI());
    assertEquals(CALLBACK_URL + "?client_name=GoogleOidcClient.1", googleOidcClient.getCallbackUrl());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:67,代码来源:PropertiesConfigFactoryTests.java

示例12: build

import org.pac4j.oauth.client.TwitterClient; //导入依赖的package包/类
public Config build() {
    final OidcClient oidcClient = new OidcClient();
    oidcClient.setClientID("343992089165-sp0l1km383i8cbm2j5nn20kbk5dk8hor.apps.googleusercontent.com");
    oidcClient.setSecret("uR3D8ej1kIRPbqAFaxIE3HWh");
    oidcClient.setDiscoveryURI("https://accounts.google.com/.well-known/openid-configuration");
    oidcClient.setUseNonce(true);
    //oidcClient.setPreferredJwsAlgorithm(JWSAlgorithm.RS256);
    oidcClient.addCustomParam("prompt", "consent");
    oidcClient.setAuthorizationGenerator(profile -> profile.addRole("ROLE_ADMIN"));

    final SAML2ClientConfiguration cfg = new SAML2ClientConfiguration("resource:samlKeystore.jks",
            "pac4j-demo-passwd",
            "pac4j-demo-passwd",
            "resource:metadata-okta.xml");
    cfg.setMaximumAuthenticationLifetime(3600);
    cfg.setServiceProviderEntityId("http://localhost:8080/callback?client_name=SAML2Client");
    cfg.setServiceProviderMetadataPath("sp-metadata.xml");
    final SAML2Client saml2Client = new SAML2Client(cfg);

    final FacebookClient facebookClient = new FacebookClient("145278422258960", "be21409ba8f39b5dae2a7de525484da8");
    final TwitterClient twitterClient = new TwitterClient("CoxUiYwQOSFDReZYdjigBA", "2kAzunH5Btc4gRSaMr7D7MkyoJ5u1VzbOOzE8rBofs");
    // HTTP
    final FormClient formClient = new FormClient("http://localhost:8080/loginForm.html", new SimpleTestUsernamePasswordAuthenticator());
    final IndirectBasicAuthClient indirectBasicAuthClient = new IndirectBasicAuthClient(new SimpleTestUsernamePasswordAuthenticator());

    // CAS
    final CasClient casClient = new CasClient("https://casserverpac4j.herokuapp.com/login");

    // REST authent with JWT for a token passed in the url as the token parameter
    ParameterClient parameterClient = new ParameterClient("token", new JwtAuthenticator(DemoServer.JWT_SALT));
    parameterClient.setSupportGetRequest(true);
    parameterClient.setSupportPostRequest(false);

    // basic auth
    final DirectBasicAuthClient directBasicAuthClient = new DirectBasicAuthClient(new SimpleTestUsernamePasswordAuthenticator());

    final AnonymousClient anonymousClient = new AnonymousClient();

    final Clients clients = new Clients("http://localhost:8080/callback", saml2Client, facebookClient, twitterClient,
            formClient, indirectBasicAuthClient, casClient, parameterClient, directBasicAuthClient, oidcClient, anonymousClient);

    final Config config = new Config(clients);
    config.addAuthorizer("admin", new RequireAnyRoleAuthorizer("ROLE_ADMIN"));
    config.addAuthorizer("custom", new CustomAuthorizer());
    return config;
}
 
开发者ID:pac4j,项目名称:undertow-pac4j-demo,代码行数:47,代码来源:DemoConfigFactory.java

示例13: twitterClient

import org.pac4j.oauth.client.TwitterClient; //导入依赖的package包/类
@Override
public TwitterClient twitterClient() {
	return null;
}
 
开发者ID:thm-projects,项目名称:arsnova-backend,代码行数:5,代码来源:TestSecurityConfig.java

示例14: twitterClient

import org.pac4j.oauth.client.TwitterClient; //导入依赖的package包/类
@Bean
public TwitterClient twitterClient() {
	return new TwitterClient(configurer.getTwitterClientKey(), configurer.getTwitterClientSecret());
}
 
开发者ID:openwide-java,项目名称:artifact-listener,代码行数:5,代码来源:MavenArtifactNotifierWebappSecurityConfig.java


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