Package io.jans.as.server.service
Class SessionIdService
- java.lang.Object
-
- io.jans.as.server.service.SessionIdService
-
@RequestScoped @Named public class SessionIdService extends Object
- Version:
- December 8, 2018
- Author:
- Yuriy Zabrovarnyy, Yuriy Movchan, Javier Rojas Blum
-
-
Constructor Summary
Constructors Constructor Description SessionIdService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
acrValuesList(String acrValues)
By definition we expects space separated acr values as it is defined in spec.io.jans.as.common.model.session.SessionId
assertAuthenticatedSessionCorrespondsToNewRequest(io.jans.as.common.model.session.SessionId session, String acrValuesStr)
String
computeSessionState(io.jans.as.common.model.session.SessionId sessionId, String clientId, String redirectUri)
void
externalEvent(SessionEvent event)
List<io.jans.as.common.model.session.SessionId>
findByUser(String userDn)
io.jans.as.common.model.session.SessionId
generateAuthenticatedSessionId(jakarta.servlet.http.HttpServletRequest httpRequest, String userDn)
io.jans.as.common.model.session.SessionId
generateAuthenticatedSessionId(jakarta.servlet.http.HttpServletRequest httpRequest, String userDn, String prompt)
io.jans.as.common.model.session.SessionId
generateAuthenticatedSessionId(jakarta.servlet.http.HttpServletRequest httpRequest, String userDn, Map<String,String> sessionIdAttributes)
io.jans.as.common.model.session.SessionId
generateUnauthenticatedSessionId(String userDn)
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)
String
getAcr(io.jans.as.common.model.session.SessionId session)
Set<io.jans.as.common.model.session.SessionId>
getCurrentSessions()
int
getServerSessionIdLifetimeInSeconds()
Map<String,String>
getSessionAttributes(io.jans.as.common.model.session.SessionId sessionId)
@Nullable io.jans.as.common.model.session.SessionId
getSessionByDeviceSecret(@Nullable String deviceSecret)
@Nullable io.jans.as.common.model.session.SessionId
getSessionByDn(@Nullable String dn)
@Nullable io.jans.as.common.model.session.SessionId
getSessionByDn(@Nullable String dn, boolean silently)
@Nullable io.jans.as.common.model.session.SessionId
getSessionById(@Nullable String sessionId, boolean silently)
@Nullable io.jans.as.common.model.session.SessionId
getSessionBySid(@Nullable String sid)
io.jans.as.common.model.session.SessionId
getSessionId()
io.jans.as.common.model.session.SessionId
getSessionId(jakarta.servlet.http.HttpServletRequest request)
io.jans.as.common.model.session.SessionId
getSessionId(String sessionId)
io.jans.as.common.model.session.SessionId
getSessionId(String sessionId, boolean silently)
io.jans.as.common.model.common.User
getUser(io.jans.as.common.model.session.SessionId sessionId)
boolean
hasAllScopes(io.jans.as.common.model.session.SessionId sessionId, Set<String> scopes)
static boolean
hasAllScopes(String existingScopes, Set<String> scopes)
boolean
hasClientAllScopes(io.jans.as.common.model.session.SessionId sessionId, String clientId, Set<String> scopes)
boolean
isExpired(io.jans.as.common.model.session.SessionId sessionId)
boolean
isSessionIdAuthenticated(io.jans.as.common.model.session.SessionId sessionId)
boolean
isSessionValid(io.jans.as.common.model.session.SessionId sessionId)
boolean
persistSessionId(io.jans.as.common.model.session.SessionId sessionId)
boolean
persistSessionId(io.jans.as.common.model.session.SessionId sessionId, boolean forcePersistence)
boolean
reinitLogin(io.jans.as.common.model.session.SessionId session, boolean force)
boolean
remove(io.jans.as.common.model.session.SessionId sessionId)
void
remove(List<io.jans.as.common.model.session.SessionId> list)
io.jans.as.common.model.session.SessionId
resetToStep(io.jans.as.common.model.session.SessionId session, int resetToStep)
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)
boolean
updateSessionId(io.jans.as.common.model.session.SessionId sessionId)
boolean
updateSessionId(io.jans.as.common.model.session.SessionId sessionId, boolean updateLastUsedAt)
boolean
updateSessionId(io.jans.as.common.model.session.SessionId sessionId, boolean updateLastUsedAt, boolean forceUpdate, boolean modified)
void
updateSessionIdIfNeeded(io.jans.as.common.model.session.SessionId sessionId, boolean modified)
-
-
-
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)
-
generateAuthenticatedSessionId
public io.jans.as.common.model.session.SessionId generateAuthenticatedSessionId(jakarta.servlet.http.HttpServletRequest httpRequest, String userDn) throws InvalidSessionStateException
- Throws:
InvalidSessionStateException
-
generateAuthenticatedSessionId
public io.jans.as.common.model.session.SessionId generateAuthenticatedSessionId(jakarta.servlet.http.HttpServletRequest httpRequest, String userDn, String prompt) throws InvalidSessionStateException
- Throws:
InvalidSessionStateException
-
generateAuthenticatedSessionId
public io.jans.as.common.model.session.SessionId generateAuthenticatedSessionId(jakarta.servlet.http.HttpServletRequest httpRequest, String userDn, Map<String,String> sessionIdAttributes) throws InvalidSessionStateException
- Throws:
InvalidSessionStateException
-
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)
-
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)
-
externalEvent
public void externalEvent(SessionEvent event)
-
-