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

Java SessionStore类代码示例

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

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



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

示例1: recordSession

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Override
public void recordSession(final VertxWebContext context, final String ticket) {
    // Record session connection as per the existing cas behaviour
    final SessionStore sessionStore = context.getSessionStore();
    if (sessionStore == null) {
        logger.error("No session store available for this web context");
    } else {

        final String sessionId = sessionStore.getOrCreateSessionId(context);
        if (sessionId != null) {
            logger.debug("ticket: {} -> sessionId: {}", ticket, sessionId);
            store.set(ticket, sessionId);
            logger.debug("Retrieved session id {}", store.get(ticket).toString());
            context.setSessionAttribute(PAC4J_CAS_TICKET, ticket); // Gives us a two-way link
        } else {
            logger.debug("Can not identify id for current session");
        }
    }
}
 
开发者ID:pac4j,项目名称:vertx-pac4j,代码行数:20,代码来源:VertxCasLogoutHandler.java


示例2: renewSession

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Override
public void renewSession(String oldSessionId, VertxWebContext context) {
    final String ticket = (String) context.getSessionAttribute(PAC4J_CAS_TICKET);
    logger.debug("oldSessionId: {} -> ticket: {}", oldSessionId, ticket);
    final SessionStore sessionStore = context.getSessionStore();
    if (!(sessionStore instanceof ExtendedSessionStore)) {
        logger.error("Session store does not support session renewal");
    } else {
        if (ticket != null) {
            store.remove(ticket);
            final ExtendedSessionStore extendedSessionStore = (ExtendedSessionStore) sessionStore;
            final Session session = extendedSessionStore.getSession(oldSessionId);
            if (session != null) { // Switch to use optional
                session.set(PAC4J_CAS_TICKET, null);
            }
            recordSession(context, ticket);
        }
    }
}
 
开发者ID:pac4j,项目名称:vertx-pac4j,代码行数:20,代码来源:VertxCasLogoutHandler.java


示例3: CallbackDeployingPac4jAuthHandler

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
public CallbackDeployingPac4jAuthHandler(final Vertx vertx,
                                         final SessionStore<VertxWebContext> sessionStore,
                                         final Config config,
                                         final Router router,
                                         final Pac4jAuthProvider authProvider,
                                         final SecurityHandlerOptions options,
                                         final CallbackHandlerOptions callbackOptions) {
    super(vertx, sessionStore, config, authProvider, options);
    // Other null checks performed by parent class
    CommonHelper.assertNotNull("router", router);
    CommonHelper.assertNotBlank("callbackUrl", config.getClients().getCallbackUrl());

    final URI uri;
    try {
        uri = new URI(config.getClients().getCallbackUrl());
    } catch (URISyntaxException e) {
        LOG.error(e.getMessage());
        throw toTechnicalException(e);
    }

    // Start manager verticle
    router.route(HttpMethod.GET, uri.getPath()).handler(authResultHandler(vertx, sessionStore, config, callbackOptions));
}
 
开发者ID:pac4j,项目名称:vertx-pac4j,代码行数:24,代码来源:CallbackDeployingPac4jAuthHandler.java


示例4: SecurityHandler

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
public SecurityHandler(final Vertx vertx,
                       final SessionStore<VertxWebContext> sessionStore,
                       final Config config, final Pac4jAuthProvider authProvider,
                       final SecurityHandlerOptions options) {
    super(authProvider);
    CommonHelper.assertNotNull("vertx", vertx);
    CommonHelper.assertNotNull("sessionStore", sessionStore);
    CommonHelper.assertNotNull("config", config);
    CommonHelper.assertNotNull("config.getClients()", config.getClients());
    CommonHelper.assertNotNull("authProvider", authProvider);
    CommonHelper.assertNotNull("options", options);

    clientNames = options.getClients();
    authorizerName = options.getAuthorizers();
    matcherName = options.getMatchers();
    multiProfile = options.isMultiProfile();
    this.vertx = vertx;
    this.sessionStore = sessionStore;
    this.config = config;

    final DefaultSecurityLogic<Void, VertxWebContext> securityLogic = new DefaultSecurityLogic<>();
    securityLogic.setProfileManagerFactory(VertxProfileManager::new);
    this.securityLogic = securityLogic;
}
 
开发者ID:pac4j,项目名称:vertx-pac4j,代码行数:25,代码来源:SecurityHandler.java


示例5: LogoutHandler

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
/**
 * Construct based on the option values provided
 *
 * @param options - the options to configure this handler
 */
public LogoutHandler(final Vertx vertx,
                     final SessionStore<VertxWebContext> sessionStore ,
                     final LogoutHandlerOptions options, final Config config) {
    final DefaultLogoutLogic<Void, VertxWebContext> defaultApplicationLogoutLogic =
            new DefaultLogoutLogic<>();
    defaultApplicationLogoutLogic.setProfileManagerFactory(VertxProfileManager::new);
    logoutLogic = defaultApplicationLogoutLogic;
    this.defaultUrl = options.getDefaultUrl();
    this.logoutUrlPattern = options.getLogoutUrlPattern();
    this.config = config;
    this.vertx = vertx;
    this.sessionStore = sessionStore;
    this.localLogout = options.isLocalLogout();
    this.destroySession = options.isDestroySession();
    this.centralLogout = options.isCentralLogout();
}
 
开发者ID:pac4j,项目名称:vertx-pac4j,代码行数:22,代码来源:LogoutHandler.java


示例6: sessionStore

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
private MockUnit.Block sessionStore(SessionStore<WebContext> ss) {
  return unit -> {
    org.pac4j.core.config.Config config = unit.get(org.pac4j.core.config.Config.class);
    expect(config.getSessionStore()).andReturn(ss);

    if (ss != null) {
      config.setSessionStore(ss);
    }

    AnnotatedBindingBuilder aab = unit.mock(AnnotatedBindingBuilder.class);
    if (ss == null) {
      expect(aab.to(Pac4jSessionStore.class)).andReturn(aab);
      expect(aab.to(Pac4jSessionStore.class)).andReturn(aab);
    } else {
      aab.toInstance(ss);
      aab.toInstance(ss);
    }

    Binder binder = unit.get(Binder.class);
    expect(binder.bind(SSTORE)).andReturn(aab);
    expect(binder.bind(SessionStore.class)).andReturn(aab);
  };
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:24,代码来源:Pac4jTest.java


示例7: requestAttribute

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Test
public void requestAttribute() throws Exception {
  new MockUnit(Request.class, Response.class, SessionStore.class)
      .expect(params(false))
      .expect(localGet("attr", "val"))
      .expect(localGet("missing", null))
      .expect(localSet("foo", "bar"))
      .run(unit -> {
        Pac4jContext pac4j = new Pac4jContext(unit.get(Request.class),
            unit.get(Response.class), unit.get(SessionStore.class));

        assertEquals("val", pac4j.getRequestAttribute("attr"));
        assertEquals(null, pac4j.getRequestAttribute("missing"));
        pac4j.setRequestAttribute("foo", "bar");
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:17,代码来源:Pac4jContextTest.java


示例8: sessionAttribute

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Test
public void sessionAttribute() throws Exception {
  new MockUnit(Request.class, Response.class, SessionStore.class)
      .expect(params(false))
      .expect(sessionGet("attr", "val"))
      .expect(sessionSet("foo", "bar"))
      .run(unit -> {
        Pac4jContext pac4j = new Pac4jContext(unit.get(Request.class),
            unit.get(Response.class), unit.get(SessionStore.class));

        assertEquals("val", pac4j.getSessionAttribute("attr"));
        pac4j.setSessionAttribute("foo", "bar");

        assertEquals(2, unit.captured(WebContext.class).size());
        unit.captured(WebContext.class).forEach(it -> assertEquals(pac4j, it));
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:18,代码来源:Pac4jContextTest.java


示例9: sessionId

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Test
public void sessionId() throws Exception {
  new MockUnit(Request.class, Response.class, SessionStore.class)
      .expect(params(false))
      .expect(unit -> {
        SessionStore session = unit.get(SessionStore.class);
        expect(session.getOrCreateSessionId(unit.capture(WebContext.class))).andReturn("sid");
      })
      .run(unit -> {
        Pac4jContext pac4j = new Pac4jContext(unit.get(Request.class),
            unit.get(Response.class), unit.get(SessionStore.class));

        assertEquals("sid", pac4j.getSessionIdentifier());

        assertEquals(pac4j, unit.captured(WebContext.class).get(0));
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:18,代码来源:Pac4jContextTest.java


示例10: requestContent

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Test
public void requestContent() throws Exception {
  new MockUnit(Request.class, Response.class, SessionStore.class)
      .expect(params(false))
      .expect(unit -> {
        Mutant body = unit.mock(Mutant.class);
        expect(body.value()).andReturn("...");

        Request req = unit.get(Request.class);
        expect(req.body()).andReturn(body);
      })
      .run(unit -> {
        Pac4jContext pac4j = new Pac4jContext(unit.get(Request.class),
            unit.get(Response.class), unit.get(SessionStore.class));

        assertEquals("...", pac4j.getRequestContent());
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:19,代码来源:Pac4jContextTest.java


示例11: serverNameAndPort

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Test
public void serverNameAndPort() throws Exception {
  new MockUnit(Request.class, Response.class, SessionStore.class)
      .expect(params(false))
      .expect(unit -> {
        Request req = unit.get(Request.class);
        expect(req.hostname()).andReturn("server");
        expect(req.port()).andReturn(123);
      })
      .run(unit -> {
        Pac4jContext pac4j = new Pac4jContext(unit.get(Request.class),
            unit.get(Response.class), unit.get(SessionStore.class));

        assertEquals("server", pac4j.getServerName());
        assertEquals(123, pac4j.getServerPort());
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:18,代码来源:Pac4jContextTest.java


示例12: scheme

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Test
public void scheme() throws Exception {
  new MockUnit(Request.class, Response.class, SessionStore.class)
      .expect(params(false))
      .expect(unit -> {
        Request req = unit.get(Request.class);
        expect(req.secure()).andReturn(false);
        expect(req.secure()).andReturn(true);
        expect(req.secure()).andReturn(false);
      })
      .run(unit -> {
        Pac4jContext pac4j = new Pac4jContext(unit.get(Request.class),
            unit.get(Response.class), unit.get(SessionStore.class));

        assertEquals("http", pac4j.getScheme());
        assertEquals("https", pac4j.getScheme());
        assertEquals(false, pac4j.isSecure());
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:20,代码来源:Pac4jContextTest.java


示例13: fullRequestURL

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Test
public void fullRequestURL() throws Exception {
  new MockUnit(Request.class, Response.class, SessionStore.class)
      .expect(params(false))
      .expect(unit -> {
        Request req = unit.get(Request.class);
        expect(req.hostname()).andReturn("server");
        expect(req.port()).andReturn(8080);
        expect(req.secure()).andReturn(false);
        expect(req.contextPath()).andReturn("");
        expect(req.path()).andReturn("/resource");
        expect(req.queryString()).andReturn(Optional.empty());
      })
      .run(unit -> {
        Pac4jContext pac4j = new Pac4jContext(unit.get(Request.class),
            unit.get(Response.class), unit.get(SessionStore.class));

        assertEquals("http://server:8080/resource", pac4j.getFullRequestURL());
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:21,代码来源:Pac4jContextTest.java


示例14: fullRequestURLWithContextPath

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Test
public void fullRequestURLWithContextPath() throws Exception {
  new MockUnit(Request.class, Response.class, SessionStore.class)
      .expect(params(false))
      .expect(unit -> {
        Request req = unit.get(Request.class);
        expect(req.hostname()).andReturn("server");
        expect(req.port()).andReturn(8080);
        expect(req.secure()).andReturn(false);
        expect(req.contextPath()).andReturn("/myapp");
        expect(req.path()).andReturn("/resource");
        expect(req.queryString()).andReturn(Optional.empty());
      })
      .run(unit -> {
        Pac4jContext pac4j = new Pac4jContext(unit.get(Request.class),
            unit.get(Response.class), unit.get(SessionStore.class));

        assertEquals("http://server:8080/myapp/resource", pac4j.getFullRequestURL());
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:21,代码来源:Pac4jContextTest.java


示例15: fullRequestURLWithContextPathAndQueryString

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Test
public void fullRequestURLWithContextPathAndQueryString() throws Exception {
  new MockUnit(Request.class, Response.class, SessionStore.class)
      .expect(params(false))
      .expect(unit -> {
        Request req = unit.get(Request.class);
        expect(req.hostname()).andReturn("server");
        expect(req.port()).andReturn(8080);
        expect(req.secure()).andReturn(true);
        expect(req.contextPath()).andReturn("/myapp");
        expect(req.path()).andReturn("/resource");
        expect(req.queryString()).andReturn(Optional.of("q=foo"));
      })
      .run(unit -> {
        Pac4jContext pac4j = new Pac4jContext(unit.get(Request.class),
            unit.get(Response.class), unit.get(SessionStore.class));

        assertEquals("https://server:8080/myapp/resource?q=foo", pac4j.getFullRequestURL());
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:21,代码来源:Pac4jContextTest.java


示例16: shouldReturnPippoSessionStoreWhenAccessed

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Test
public void shouldReturnPippoSessionStoreWhenAccessed() {
    PippoWebContext context = makePippoWebContext();

    SessionStore<PippoWebContext> sessionStore = context.getSessionStore();
    assertThat(sessionStore, instanceOf(PippoSessionStore.class));
    assertThat(sessionStore.getTrackableSession(context), is(mockSession));
}
 
开发者ID:codematix,项目名称:pippo-pac4j,代码行数:9,代码来源:PippoWebContextTests.java


示例17: J2EContext

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
/**
 * Build a J2E context from the current HTTP request and response.
 *
 * @param request      the current request
 * @param response     the current response
 * @param sessionStore the session store to use
 */
public J2EContext(final HttpServletRequest request, final HttpServletResponse response, final SessionStore<J2EContext> sessionStore) {
    this.request = request;
    this.response = response;
    if (sessionStore == null) {
        this.sessionStore = new J2ESessionStore();
    } else {
        this.sessionStore = sessionStore;
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:17,代码来源:J2EContext.java


示例18: setup

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Override
public void setup(Bootstrap<?> bootstrap) {
    ObjectMapper om = bootstrap.getObjectMapper();

    // for Config
    om.addMixIn(SessionStore.class, sessionStoreMixin());
    om.addMixIn(Authorizer.class, authorizerMixin());
    om.addMixIn(HttpActionAdapter.class, httpActionAdapterMixin());
    om.addMixIn(Matcher.class, matcherMixin());
    om.addMixIn(SecurityLogic.class, securityLogicMixin());
    om.addMixIn(CallbackLogic.class, callbackLogicMixin());
    om.addMixIn(LogoutLogic.class, logoutLogicMixin());

    // for Clients
    om.addMixIn(Client.class, clientMixin());
    om.addMixIn(BaseClient.class, baseClientMixin());

    // for Clients and Client subsclasses
    om.addMixIn(AjaxRequestResolver.class, ajaxRequestResolverMixin());
    om.addMixIn(UrlResolver.class, urlResolverMixin());
    om.addMixIn(AuthorizationGenerator.class,
            authorizationGeneratorMixin());

    // for Client/BaseClient
    om.addMixIn(Authenticator.class, authenticatorMixin());
    om.addMixIn(CredentialsExtractor.class, credentialExtractorMixin());
    om.addMixIn(ProfileCreator.class, profileCreatorMixin());

    // for IndirectClient
    om.addMixIn(RedirectActionBuilder.class, redirectActionBuilderMixin());
    om.addMixIn(LogoutActionBuilder.class, logoutActionBuilderMixin());
    
    // for some of the Authenticators
    om.addMixIn(PasswordEncoder.class, passwordEncoderMixin());
}
 
开发者ID:pac4j,项目名称:dropwizard-pac4j,代码行数:36,代码来源:DefaultFeatureSupport.java


示例19: setSessionStore

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Override
public void setSessionStore(SessionStore sessionStore) {
    if (sessionStore == null) {
        super.setSessionStore(new ServletSessionStore());
    } else {
        super.setSessionStore(sessionStore);
    }
}
 
开发者ID:pac4j,项目名称:jax-rs-pac4j,代码行数:9,代码来源:ServletJaxRsContext.java


示例20: setSessionStore

import org.pac4j.core.context.session.SessionStore; //导入依赖的package包/类
@Override
public void setSessionStore(SessionStore sessionStore) {
    if (sessionStore == null) {
        super.setSessionStore(new GrizzlySessionStore());
    } else {
        super.setSessionStore(sessionStore);
    }
}
 
开发者ID:pac4j,项目名称:jax-rs-pac4j,代码行数:9,代码来源:GrizzlyJaxRsContext.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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