Package com.wavemaker.runtime.security
Class SecurityService
java.lang.Object
com.wavemaker.runtime.security.SecurityService
The Security Service provides interfaces to access authentication and authorization information in the system.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddAttribute(String key, Object value, Attribute.AttributeScope attributeScope) Get Current LoggedIn User.com.wavemaker.app.security.models.LoginConfiglongIt returns Login Time of the current user when userDetail object in current security context is not null, otherwise, it returns 0.getRoles()static intDeprecated.Returns the user id of the principal in the current security context, otherwise, it returns name of the authenticated user..If authentication is null then it returns empty String array.Returns the user name of the principal in the current security context.String[]If authentication is null then it returns empty String array.booleanChecks whether the user has been authenticated or not depending on authentication object.booleanChecks whether the security is enabled or not.voidssoLogin()
-
Constructor Details
-
SecurityService
public SecurityService()
-
-
Method Details
-
getTenantId
Deprecated.This method is deprecated. You can set custom attributes in successhandlers. -
isSecurityEnabled
public boolean isSecurityEnabled()Checks whether the security is enabled or not. It returns true if it is enable, else, false.- Returns:
- true if the security is enabled; otherwise, false.
-
getLoginConfig
public com.wavemaker.app.security.models.LoginConfig getLoginConfig() -
isAuthenticated
public boolean isAuthenticated()Checks whether the user has been authenticated or not depending on authentication object.- Returns:
- true if the user was authenticated; otherwise, false.
-
getClientAttributes
-
getAllAttributes
-
addAttribute
-
getLoggedInUser
Get Current LoggedIn User. If security is enabled and user is authenticated then other fields like userId, userName, tenantId, userRoles etc are also set, otherwise, only securityEnabled value is set.- Returns:
- WMCurrentUser type.
-
getUserName
Returns the user name of the principal in the current security context. If theUserDetailsobtained from authentication is an instance ofWMUserDetails,then user's long name is returned from WMUserDetails, else returns the username from authentication Object. Second case happens when services like ldap are used to authenticate- Returns:
- The user name.
-
getUserId
Returns the user id of the principal in the current security context, otherwise, it returns name of the authenticated user..- Returns:
- String value, which will contain userId.
-
getUserRoles
If authentication is null then it returns empty String array. If not then it will retrieve the authority and process the roleName in the spring format before returning and then return.- Returns:
- String array with roles or empty depending on authentication object.
-
getUserLandingPage
If authentication is null then it returns empty String array. If not then it will retrieve the authority and process the roleName in the spring format before returning and then return.- Returns:
- String array with roles or empty depending on authentication object.
-
getLoginTime
public long getLoginTime()It returns Login Time of the current user when userDetail object in current security context is not null, otherwise, it returns 0.- Returns:
- login tine in milliseconds (long value).
-
getRoles
-
getSecurityInfo
-
getAppSecurityInfo
-
generateUserAccessToken
-
ssoLogin
public void ssoLogin()
-