Interface SecurityApi
-
- All Superinterfaces:
KillbillApi
public interface SecurityApi extends KillbillApi
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddRoleDefinition(String role, List<String> permissions, CallContext context)Add a role definition in the Shiro store (JDBCRealm)voidaddUserRoles(String username, String clearPassword, List<String> roles, CallContext context)Add a user with roles in the Shiro store (JDBCRealm)voidcheckCurrentUserPermissions(List<Permission> permissions, Logical logical, TenantContext context)Check the current user has the set of permissions.Set<String>getCurrentUserPermissions(TenantContext context)Return the set of permissions for the currently logged-in user.List<String>getRoleDefinition(String role, TenantContext tenantContext)Retrieves the list of permissions associated to that role in the Shiro store (JDBCRealm)List<String>getUserRoles(String username, TenantContext tenantContext)Retrieves the roles associated to a user in the Shiro store (JDBCRealm)voidinvalidateUser(String username, CallContext context)Invalidate a userbooleanisSubjectAuthenticated()voidlogin(Object principal, Object credentials)Perform a login attempt.voidlogout()Log out the current user and invalidate and/or remove any associated entities (e.g.voidupdateRoleDefinition(String role, List<String> permissions, CallContext context)voidupdateUserPassword(String username, String clearPassword, CallContext context)Update password for the uservoidupdateUserRoles(String username, List<String> roles, CallContext context)Update the roles associated with the user (only the specified roles will be in effect)
-
-
-
Method Detail
-
login
void login(Object principal, Object credentials)
Perform a login attempt.- Parameters:
principal- account identity (e.g. username)credentials- account credentials (e.g. password)
-
logout
void logout()
Log out the current user and invalidate and/or remove any associated entities (e.g. session).
-
isSubjectAuthenticated
boolean isSubjectAuthenticated()
- Returns:
- true if the subscjet is authenticated
-
getCurrentUserPermissions
Set<String> getCurrentUserPermissions(TenantContext context)
Return the set of permissions for the currently logged-in user.- Parameters:
context- tenant context- Returns:
- the set of permissions for the current user
-
checkCurrentUserPermissions
void checkCurrentUserPermissions(List<Permission> permissions, Logical logical, TenantContext context) throws SecurityApiException
Check the current user has the set of permissions.- Parameters:
permissions- set of permissions to checklogical- rule to use for multiple permissionscontext- tenant context- Throws:
SecurityExceptionSecurityApiException
-
addUserRoles
void addUserRoles(String username, String clearPassword, List<String> roles, CallContext context) throws SecurityApiException
Add a user with roles in the Shiro store (JDBCRealm)- Parameters:
username- the usernameclearPassword- the password (in clear)roles- the list of (existing) rolescontext- context (does not include tenant nor account info)- Throws:
SecurityApiException
-
updateUserPassword
void updateUserPassword(String username, String clearPassword, CallContext context) throws SecurityApiException
Update password for the user- Parameters:
username- the usernameclearPassword- the password (in clear)context- context (does not include tenant nor account info)- Throws:
SecurityApiException
-
updateUserRoles
void updateUserRoles(String username, List<String> roles, CallContext context) throws SecurityApiException
Update the roles associated with the user (only the specified roles will be in effect)- Parameters:
username- the usernameroles- the new rolescontext- context (does not include tenant nor account info)- Throws:
SecurityApiException
-
invalidateUser
void invalidateUser(String username, CallContext context) throws SecurityApiException
Invalidate a user- Parameters:
username- the usernamecontext- context (does not include tenant nor account info)- Throws:
SecurityApiException
-
getUserRoles
List<String> getUserRoles(String username, TenantContext tenantContext) throws SecurityApiException
Retrieves the roles associated to a user in the Shiro store (JDBCRealm)- Parameters:
username- the usernametenantContext- dummy context- Returns:
- roles for a specific user
- Throws:
SecurityApiException
-
addRoleDefinition
void addRoleDefinition(String role, List<String> permissions, CallContext context) throws SecurityApiException
Add a role definition in the Shiro store (JDBCRealm)- Parameters:
role- the role namepermissions- the list of permissionscontext- context (does not include tenant nor account info)- Throws:
SecurityApiException- See Also:
Permission
-
updateRoleDefinition
void updateRoleDefinition(String role, List<String> permissions, CallContext context) throws SecurityApiException
- Throws:
SecurityApiException
-
getRoleDefinition
List<String> getRoleDefinition(String role, TenantContext tenantContext)
Retrieves the list of permissions associated to that role in the Shiro store (JDBCRealm)- Parameters:
role- the role nametenantContext- dummy context- Returns:
-
-