Class SessionIdService


  • @RequestScoped
    @Named
    public class SessionIdService
    extends Object
    Version:
    December 8, 2018
    Author:
    Yuriy Zabrovarnyy, Yuriy Movchan, Javier Rojas Blum
    • Constructor Detail

      • SessionIdService

        public SessionIdService()
    • Method Detail

      • getCurrentSessions

        public Set<io.jans.as.common.model.session.SessionId> getCurrentSessions()
      • getAcr

        public String getAcr​(io.jans.as.common.model.session.SessionId session)
      • assertAuthenticatedSessionCorrespondsToNewRequest

        public io.jans.as.common.model.session.SessionId assertAuthenticatedSessionCorrespondsToNewRequest​(io.jans.as.common.model.session.SessionId session,
                                                                                                           String acrValuesStr)
                                                                                                    throws AcrChangedException
        Throws:
        AcrChangedException
      • reinitLogin

        public boolean reinitLogin​(io.jans.as.common.model.session.SessionId session,
                                   boolean force)
        Parameters:
        session -
        force -
        Returns:
        returns whether session was updated
      • resetToStep

        public io.jans.as.common.model.session.SessionId resetToStep​(io.jans.as.common.model.session.SessionId session,
                                                                     int resetToStep)
      • getSessionId

        public io.jans.as.common.model.session.SessionId getSessionId()
      • getSessionAttributes

        public Map<String,​String> getSessionAttributes​(io.jans.as.common.model.session.SessionId sessionId)
      • generateUnauthenticatedSessionId

        public io.jans.as.common.model.session.SessionId generateUnauthenticatedSessionId​(String userDn)
      • generateUnauthenticatedSessionId

        public io.jans.as.common.model.session.SessionId generateUnauthenticatedSessionId​(String userDn,
                                                                                          Date authenticationDate,
                                                                                          io.jans.as.common.model.session.SessionIdState state,
                                                                                          Map<String,​String> sessionIdAttributes,
                                                                                          boolean persist)
      • computeSessionState

        public String computeSessionState​(io.jans.as.common.model.session.SessionId sessionId,
                                          String clientId,
                                          String redirectUri)
      • setSessionIdStateAuthenticated

        public io.jans.as.common.model.session.SessionId setSessionIdStateAuthenticated​(jakarta.servlet.http.HttpServletRequest httpRequest,
                                                                                        jakarta.servlet.http.HttpServletResponse httpResponse,
                                                                                        io.jans.as.common.model.session.SessionId sessionId,
                                                                                        String userDn)
      • persistSessionId

        public boolean persistSessionId​(io.jans.as.common.model.session.SessionId sessionId)
      • persistSessionId

        public boolean persistSessionId​(io.jans.as.common.model.session.SessionId sessionId,
                                        boolean forcePersistence)
      • updateSessionId

        public boolean updateSessionId​(io.jans.as.common.model.session.SessionId sessionId)
      • updateSessionId

        public boolean updateSessionId​(io.jans.as.common.model.session.SessionId sessionId,
                                       boolean updateLastUsedAt)
      • updateSessionId

        public boolean updateSessionId​(io.jans.as.common.model.session.SessionId sessionId,
                                       boolean updateLastUsedAt,
                                       boolean forceUpdate,
                                       boolean modified)
      • isExpired

        public boolean isExpired​(io.jans.as.common.model.session.SessionId sessionId)
      • getServerSessionIdLifetimeInSeconds

        public int getServerSessionIdLifetimeInSeconds()
      • updateSessionIdIfNeeded

        public void updateSessionIdIfNeeded​(io.jans.as.common.model.session.SessionId sessionId,
                                            boolean modified)
      • getSessionById

        @Nullable
        public @Nullable io.jans.as.common.model.session.SessionId getSessionById​(@Nullable
                                                                                  @Nullable String sessionId,
                                                                                  boolean silently)
      • getSessionByDn

        @Nullable
        public @Nullable io.jans.as.common.model.session.SessionId getSessionByDn​(@Nullable
                                                                                  @Nullable String dn)
      • getSessionBySid

        @Nullable
        public @Nullable io.jans.as.common.model.session.SessionId getSessionBySid​(@Nullable
                                                                                   @Nullable String sid)
      • getSessionByDeviceSecret

        @Nullable
        public @Nullable io.jans.as.common.model.session.SessionId getSessionByDeviceSecret​(@Nullable
                                                                                            @Nullable String deviceSecret)
      • getSessionByDn

        @Nullable
        public @Nullable io.jans.as.common.model.session.SessionId getSessionByDn​(@Nullable
                                                                                  @Nullable String dn,
                                                                                  boolean silently)
      • getSessionId

        public io.jans.as.common.model.session.SessionId getSessionId​(jakarta.servlet.http.HttpServletRequest request)
      • getSessionId

        public io.jans.as.common.model.session.SessionId getSessionId​(String sessionId)
      • getSessionId

        public io.jans.as.common.model.session.SessionId getSessionId​(String sessionId,
                                                                      boolean silently)
      • remove

        public boolean remove​(io.jans.as.common.model.session.SessionId sessionId)
      • remove

        public void remove​(List<io.jans.as.common.model.session.SessionId> list)
      • isSessionValid

        public boolean isSessionValid​(io.jans.as.common.model.session.SessionId sessionId)
      • isSessionIdAuthenticated

        public boolean isSessionIdAuthenticated​(io.jans.as.common.model.session.SessionId sessionId)
      • acrValuesList

        public List<String> acrValuesList​(String acrValues)
        By definition we expects space separated acr values as it is defined in spec. But we also try maybe some client sent it to us as json array. So we try both.
        Returns:
        acr value list
      • getUser

        public io.jans.as.common.model.common.User getUser​(io.jans.as.common.model.session.SessionId sessionId)
      • findByUser

        public List<io.jans.as.common.model.session.SessionId> findByUser​(String userDn)
      • hasAllScopes

        public boolean hasAllScopes​(io.jans.as.common.model.session.SessionId sessionId,
                                    Set<String> scopes)
      • hasClientAllScopes

        public boolean hasClientAllScopes​(io.jans.as.common.model.session.SessionId sessionId,
                                          String clientId,
                                          Set<String> scopes)
      • hasAllScopes

        public static boolean hasAllScopes​(String existingScopes,
                                           Set<String> scopes)
      • externalEvent

        public void externalEvent​(SessionEvent event)