org.springframework.security.core.session.SessionRegistry Java Examples

The following examples show how to use org.springframework.security.core.session.SessionRegistry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultUserService.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public DefaultUserService( UserStore userStore, UserGroupService userGroupService,
    UserCredentialsStore userCredentialsStore, UserAuthorityGroupStore userAuthorityGroupStore,
    CurrentUserService currentUserService, SystemSettingManager systemSettingManager,
    @Lazy PasswordManager passwordManager, @Lazy SessionRegistry sessionRegistry )
{
    checkNotNull( userStore );
    checkNotNull( userGroupService );
    checkNotNull( userCredentialsStore );
    checkNotNull( userAuthorityGroupStore );
    checkNotNull( systemSettingManager );
    checkNotNull( passwordManager );
    checkNotNull( sessionRegistry );

    this.userStore = userStore;
    this.userGroupService = userGroupService;
    this.userCredentialsStore = userCredentialsStore;
    this.userAuthorityGroupStore = userAuthorityGroupStore;
    this.currentUserService = currentUserService;
    this.systemSettingManager = systemSettingManager;
    this.passwordManager = passwordManager;
    this.sessionRegistry = sessionRegistry;
}
 
Example #2
Source File: RecommendationServiceImpl.java    From inception with Apache License 2.0 6 votes vote down vote up
@Autowired
public RecommendationServiceImpl(SessionRegistry aSessionRegistry, UserDao aUserRepository,
        RecommenderFactoryRegistry aRecommenderFactoryRegistry,
        SchedulingService aSchedulingService, AnnotationSchemaService aAnnoService,
        DocumentService aDocumentService, LearningRecordService aLearningRecordService,
        ProjectService aProjectService, EntityManager aEntityManager,
        ApplicationEventPublisher aApplicationEventPublisher)
{
    sessionRegistry = aSessionRegistry;
    userRepository = aUserRepository;
    recommenderFactoryRegistry = aRecommenderFactoryRegistry;
    schedulingService = aSchedulingService;
    annoService = aAnnoService;
    documentService = aDocumentService;
    learningRecordService = aLearningRecordService;
    projectService = aProjectService;
    entityManager = aEntityManager;
    applicationEventPublisher = aApplicationEventPublisher;
    
    trainingTaskCounter = new ConcurrentHashMap<>();
    states = new ConcurrentHashMap<>();
}
 
Example #3
Source File: UserSessionController.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Autowired
public UserSessionController(SessionRegistry sessionRegistry) {
    if (sessionRegistry == null) {
        throw new IllegalArgumentException("sessionRegistry cannot be null");
    }
    this.sessionRegistry = sessionRegistry;
}
 
Example #4
Source File: DefaultCurrentUserService.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public DefaultCurrentUserService( Environment env, CacheProvider cacheProvider,
    @Lazy SessionRegistry sessionRegistry, @Lazy UserStore userStore )
{
    checkNotNull( env );
    checkNotNull( cacheProvider );
    checkNotNull( sessionRegistry );
    checkNotNull( userStore );

    this.env = env;
    this.cacheProvider = cacheProvider;
    this.sessionRegistry = sessionRegistry;
    this.userStore = userStore;
}
 
Example #5
Source File: UserSessionController.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Autowired
public UserSessionController(SessionRegistry sessionRegistry) {
    if (sessionRegistry == null) {
        throw new IllegalArgumentException("sessionRegistry cannot be null");
    }
    this.sessionRegistry = sessionRegistry;
}
 
Example #6
Source File: RecommendationServiceImpl.java    From inception with Apache License 2.0 5 votes vote down vote up
public RecommendationServiceImpl(SessionRegistry aSessionRegistry, UserDao aUserRepository,
        RecommenderFactoryRegistry aRecommenderFactoryRegistry,
        SchedulingService aSchedulingService, AnnotationSchemaService aAnnoService,
        DocumentService aDocumentService, LearningRecordService aLearningRecordService,
        EntityManager aEntityManager)
{
    this(aSessionRegistry, aUserRepository, aRecommenderFactoryRegistry, aSchedulingService,
            aAnnoService, aDocumentService, aLearningRecordService, (ProjectService) null,
            aEntityManager, null);
}
 
Example #7
Source File: RecommenderServiceAutoConfiguration.java    From inception with Apache License 2.0 5 votes vote down vote up
@Bean
@Autowired
public RecommendationService recommendationService(SessionRegistry aSessionRegistry,
        UserDao aUserRepository, RecommenderFactoryRegistry aRecommenderFactoryRegistry,
        SchedulingService aSchedulingService, AnnotationSchemaService aAnnoService,
        DocumentService aDocumentService, LearningRecordService aLearningRecordService,
        ProjectService aProjectService, ApplicationEventPublisher aApplicationEventPublisher)
{
    return new RecommendationServiceImpl(aSessionRegistry, aUserRepository,
            aRecommenderFactoryRegistry, aSchedulingService, aAnnoService, aDocumentService,
            aLearningRecordService, aProjectService, entityManager, aApplicationEventPublisher);
}
 
Example #8
Source File: SessionConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
/**
     * sessionAuthenticationStrategy does not work in JavaConfig
     * @param sessionRegistry
     * @return
     */
//    @Bean
    public SessionAuthenticationStrategy sessionAuthenticationStrategy(SessionRegistry sessionRegistry){
        return new ConcurrentSessionControlAuthenticationStrategy(sessionRegistry){{
            setMaximumSessions(-1);
        }};
    }
 
Example #9
Source File: UserSessionController.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public UserSessionController(SessionRegistry sessionRegistry) {
    if (sessionRegistry == null) {
        throw new IllegalArgumentException("sessionRegistry cannot be null");
    }
    this.sessionRegistry = sessionRegistry;
}
 
Example #10
Source File: SessionConfig.java    From zhcet-web with Apache License 2.0 4 votes vote down vote up
public SessionConfig(SessionRegistry sessionRegistry) {
    this.sessionRegistry = sessionRegistry;
}
 
Example #11
Source File: SessionConfig.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
/**
 * sessionAuthenticationStrategy does not work in JavaConfig
 * @param sessionRegistry
 * @return
 */
@Bean
public SessionAuthenticationStrategy sessionAuthenticationStrategy(SessionRegistry sessionRegistry){
    return new ConcurrentSessionControlAuthenticationStrategy(sessionRegistry){{
        setMaximumSessions(-1);
    }};
}
 
Example #12
Source File: SessionConfig.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Bean
public SessionRegistry sessionRegistry(){
    return new SessionRegistryImpl();
}
 
Example #13
Source File: UserSessionController.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public UserSessionController(SessionRegistry sessionRegistry) {
    if (sessionRegistry == null) {
        throw new IllegalArgumentException("sessionRegistry cannot be null");
    }
    this.sessionRegistry = sessionRegistry;
}
 
Example #14
Source File: UserSessionController.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public UserSessionController(SessionRegistry sessionRegistry) {
    if (sessionRegistry == null) {
        throw new IllegalArgumentException("sessionRegistry cannot be null");
    }
    this.sessionRegistry = sessionRegistry;
}
 
Example #15
Source File: SessionConfig.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Bean
public SessionRegistry sessionRegistry(){
    return new SessionRegistryImpl();
}
 
Example #16
Source File: UserSessionController.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public UserSessionController(SessionRegistry sessionRegistry) {
    if (sessionRegistry == null) {
        throw new IllegalArgumentException("sessionRegistry cannot be null");
    }
    this.sessionRegistry = sessionRegistry;
}
 
Example #17
Source File: WebSecurityConfig.java    From jeesupport with MIT License 4 votes vote down vote up
@Bean
public SessionRegistry sessionRegistry(){
    return new SessionRegistryImpl();
}
 
Example #18
Source File: _CacheConfiguration.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Use by Spring Security, to get events from Hazelcast.
 */
@Bean
public SessionRegistry sessionRegistry() {
    return new SessionRegistryImpl();
}
 
Example #19
Source File: SecurityConfig.java    From spring-boot-samples with Apache License 2.0 4 votes vote down vote up
@Bean
public SessionRegistry sessionRegistry() {
    return new SessionRegistryImpl();
}
 
Example #20
Source File: MatomoTelemetrySupportImpl.java    From webanno with Apache License 2.0 4 votes vote down vote up
@Autowired
public MatomoTelemetrySupportImpl(TelemetryService aTelemetryService,
        InstanceIdentityService aIdentityService, UserDao aUserDao,
        SessionRegistry aSessionRegistry,
        @Value("${spring.application.name}") String aApplicationName)
{
    telemetryService = aTelemetryService;
    identityService = aIdentityService;
    userService = aUserDao;
    applicationName = aApplicationName;
    sessionRegistry = aSessionRegistry;
    
    PiwikConfig config = new PiwikConfig.Builder()
            .scheme(TELEMETRY_SERVER_SCHEME)
            .host(TELEMETRY_SERVER_HOST)
            .path(TELEMETRY_SERVER_PATH)
            .addIdSite(TELEMETRY_SITE_ID)
            .build();

    scheduler = Executors.newSingleThreadScheduledExecutor();
    
    // Pinging at a 29 minute interval allows Matomo to detect continuous activity. Pings are
    // only send if here are actually active users logged in.
    scheduler.scheduleAtFixedRate(() -> sendPing(), 29, 29, TimeUnit.MINUTES);
    
    // Server deployments are expected to run for a very long time. Also, they may be without
    // any active users for a long time. So we send an alive signal every 24 hours no matter
    // if any users are actively logged in
    scheduler.scheduleAtFixedRate(() -> sendAlive(), 24, 24, TimeUnit.HOURS);
    
    try {
        SSLContext trustAllSslContext = SSLContext.getInstance("SSL");
        trustAllSslContext.init(null, trustAllCerts, new java.security.SecureRandom());

        OkHttpClient client = new OkHttpClient.Builder()
                .sslSocketFactory(trustAllSslContext.getSocketFactory(),
                        (X509TrustManager) trustAllCerts[0])
                .build();

        tracker = new PiwikTracker(config, client);
    }
    catch (Exception e) {
        log.info("Unable to set up telemetry client: {}", e.getMessage());
        tracker = null;
    }
}
 
Example #21
Source File: UserMetricsImpl.java    From webanno with Apache License 2.0 4 votes vote down vote up
@Autowired
public UserMetricsImpl(UserDao aUserRepository, SessionRegistry aSessionRegistry)
{
    userRepository = aUserRepository;
    sessionRegistry = aSessionRegistry;
}
 
Example #22
Source File: SessionListener.java    From webanno with Apache License 2.0 4 votes vote down vote up
@Autowired
public SessionListener(SessionRegistry aSessionRegistry)
{
    sessionRegistry = aSessionRegistry;
}
 
Example #23
Source File: WebAnnoSecurity.java    From webanno with Apache License 2.0 4 votes vote down vote up
@Bean
public SessionRegistry sessionRegistry()
{
    return new SessionRegistryImpl();
}
 
Example #24
Source File: SmsCodeFilter.java    From FEBS-Security with Apache License 2.0 4 votes vote down vote up
public SessionRegistry getSessionRegistry() {
    return sessionRegistry;
}
 
Example #25
Source File: WebSessionConfiguration.java    From cola with MIT License 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(SessionRegistry.class)
public SessionRegistry sessionRegistry() {
	return new SessionRegistryImpl();
}
 
Example #26
Source File: WebSessionConfiguration.java    From cola with MIT License 4 votes vote down vote up
@Bean
public SessionAuthenticationStrategy sessionAuthenticationStrategy(SessionRegistry sessionRegistry) {
	return new ConcurrentSessionControlAuthenticationStrategy(sessionRegistry);
}
 
Example #27
Source File: BaseAdminApplication.java    From base-admin with MIT License 4 votes vote down vote up
/**
 * 解决不能注入session注册表问题
 */
@Bean
SessionRegistry sessionRegistry() {
    return new SessionRegistryImpl();
}
 
Example #28
Source File: WebSecurityConfig.java    From blog-sample with Apache License 2.0 4 votes vote down vote up
@Bean
public SessionRegistry sessionRegistry() {
    return new SessionRegistryImpl();
}
 
Example #29
Source File: WebSecurityConfig.java    From blog-sample with Apache License 2.0 4 votes vote down vote up
@Bean
public SessionRegistry sessionRegistry() {
    return new SessionRegistryImpl();
}
 
Example #30
Source File: WebSecurityConfig.java    From blog-sample with Apache License 2.0 4 votes vote down vote up
@Bean
public SessionRegistry sessionRegistry() {
    return new SessionRegistryImpl();
}