-
Notifications
You must be signed in to change notification settings - Fork 544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Session Management feature #2288
Conversation
...ation/authentication/framework/handler/request/impl/DefaultAuthenticationRequestHandler.java
Outdated
Show resolved
Hide resolved
...ation/authentication/framework/handler/request/impl/DefaultAuthenticationRequestHandler.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few changes
.../main/java/org/wso2/carbon/identity/application/authentication/framework/util/JdbcUtils.java
Outdated
Show resolved
Hide resolved
.../main/java/org/wso2/carbon/identity/application/authentication/framework/util/JdbcUtils.java
Outdated
Show resolved
Hide resolved
...ication/authentication/framework/exception/session/mgt/SessionManagementClientException.java
Outdated
Show resolved
Hide resolved
.../wso2/carbon/identity/application/authentication/framework/UserSessionManagementService.java
Show resolved
Hide resolved
...n/java/org/wso2/carbon/identity/application/authentication/framework/dao/UserSessionDAO.java
Show resolved
Hide resolved
...n/java/org/wso2/carbon/identity/application/authentication/framework/dao/UserSessionDAO.java
Outdated
Show resolved
Hide resolved
import org.wso2.carbon.database.utils.jdbc.exceptions.DataAccessException; | ||
import org.wso2.carbon.identity.application.authentication.framework.dao.UserSessionDAO; | ||
import org.wso2.carbon.identity.application.authentication.framework.exception.session.mgt | ||
.SessionManagementServerException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a single line would have better readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it will exceed the max length of that line. Is it okay break that rule for readability?
...g/wso2/carbon/identity/application/authentication/framework/dao/impl/UserSessionDAOImpl.java
Show resolved
Hide resolved
...y/application/authentication/framework/exception/session/mgt/SessionManagementException.java
Outdated
Show resolved
Hide resolved
...va/org/wso2/carbon/identity/application/authentication/framework/store/UserSessionStore.java
Outdated
Show resolved
Hide resolved
@@ -543,6 +568,35 @@ private void storeSessionData(AuthenticationContext context, String sessionConte | |||
"user store domain: " + userStoreDomain + " in tenant domain: " + tenantDomain , e); | |||
} | |||
} | |||
|
|||
try { | |||
if (appId != -1 && !UserSessionStore.getInstance().isExistingAppSession(sessionContextKey, subject, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to move this -1 to a constant with a descriptive name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
...g/wso2/carbon/identity/application/authentication/framework/dao/impl/UserSessionDAOImpl.java
Outdated
Show resolved
Hide resolved
case SessionMgtConstants.LOGIN_TIME: | ||
userSession.setLoginTime(value); | ||
default: | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to break by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the default break
...ication/authentication/framework/exception/session/mgt/SessionManagementClientException.java
Outdated
Show resolved
Hide resolved
this.description = description; | ||
} | ||
|
||
// The constructor is made private to avoid generating exceptions without error code and description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use /** for the method level comments. Also the constructor is not private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
...y/application/authentication/framework/exception/session/mgt/SessionManagementException.java
Outdated
Show resolved
Hide resolved
super(error, description, cause); | ||
} | ||
|
||
// The constructor is made private to avoid generating exceptions without error code and description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use /** for the method level comments.
410f73a
to
216fc57
Compare
@@ -20,6 +20,8 @@ | |||
|
|||
import org.apache.commons.logging.Log; | |||
import org.apache.commons.logging.LogFactory; | |||
import org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
For this feature to execute, we need to add the following configuration in
|
Description
This PR contains the session management functionality.
New functions were added to
Approach
Two tables to store the user's application information.
These tables get populated during the authentication flow.
Related Issues
#1832
wso2/product-is#5769
Checklist (for reviewing)
General
Functionality
Code
Tests
Security
Documentation