Package org.keycloak.models.sessions.jpa.entities

Examples of org.keycloak.models.sessions.jpa.entities.UserSessionEntity


    }

    @Override
    public void setUserSession(UserSessionModel userSession) {
        UserSessionAdapter adapter = (UserSessionAdapter)userSession;
        UserSessionEntity userSessionEntity = adapter.getEntity();
        entity.setSession(userSessionEntity);
        userSessionEntity.getClientSessions().add(entity);
    }
View Full Code Here


        return new UsernameLoginFailureAdapter(entity);
    }

    @Override
    public UserSessionModel createUserSession(RealmModel realm, UserModel user, String loginUsername, String ipAddress, String authMethod, boolean rememberMe) {
        UserSessionEntity entity = new UserSessionEntity();
        entity.setId(KeycloakModelUtils.generateId());
        entity.setRealmId(realm.getId());
        entity.setUserId(user.getId());
        entity.setLoginUsername(loginUsername);
        entity.setIpAddress(ipAddress);
        entity.setAuthMethod(authMethod);
        entity.setRememberMe(rememberMe);

        int currentTime = Time.currentTime();

        entity.setStarted(currentTime);
        entity.setLastSessionRefresh(currentTime);

        em.persist(entity);
        return new UserSessionAdapter(session, em, realm, entity);
    }
View Full Code Here

        return new UserSessionAdapter(session, em, realm, entity);
    }

    @Override
    public UserSessionModel getUserSession(RealmModel realm, String id) {
        UserSessionEntity entity = em.find(UserSessionEntity.class, id);
        return entity != null ? new UserSessionAdapter(session, em, realm, entity) : null;
    }
View Full Code Here

        return ((Number)count).intValue();
    }

    @Override
    public void removeUserSession(RealmModel realm, UserSessionModel session) {
        UserSessionEntity entity = em.find(UserSessionEntity.class, session.getId());
        if (entity != null) {
            em.remove(entity);
        }
    }
View Full Code Here

TOP

Related Classes of org.keycloak.models.sessions.jpa.entities.UserSessionEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.