public abstract class Authorization extends Object
| Constructor and Description |
|---|
Authorization() |
| Modifier and Type | Method and Description |
|---|---|
abstract String |
getUserAttribute(String attributeName)
Returns the value for the specified attribute which is part of JWT.
|
abstract String |
getUserId()
Returns the ID of this current user.
|
abstract String |
getUserName()
Returns the name of this current user.
|
String |
getWhereCondition()
Gets the string that has to be updated in the SQL Query as a where condition.
|
abstract boolean |
hasEntityAccess(String entityName,
String operation)
Checks if current user is granted access to access the given Odata entity to perform
the given operation(READ/WRITE).
|
abstract boolean |
hasUserRole(String roleName)
Checks the current user has the given role or not.
|
abstract boolean |
isAuthenticatedUser(String serviceName)
Checks if current user is authenticated and given OData service requires
authenticated user to access it.
|
abstract boolean |
isRegisteredUser(String serviceName)
Checks if current user is registered user and given OData service requires
registered user to access it.
|
void |
rejectRequest()
It rejects the request and throws an Unauthorized Exception.
|
void |
setWhereCondition(String whereCondition)
Sets the string that has to be updated in the SQL Query as a where condition.
|
public abstract boolean isAuthenticatedUser(String serviceName)
serviceName - the OData service name.public abstract boolean isRegisteredUser(String serviceName)
serviceName - the OData service name.public abstract boolean hasEntityAccess(String entityName, String operation)
entityName - the OData entity name.operation - READ or WRITE.public abstract String getUserName()
String containing the current principal's user name.public abstract String getUserId()
String containing the current principal's user id.public abstract boolean hasUserRole(String roleName)
roleName - the role name.true if user has the given role otherwise falsepublic abstract String getUserAttribute(String attributeName)
attributeName - the attribute name same as in JWT token.String if user has the given value for given attribute otherwise nullpublic String getWhereCondition()
public void setWhereCondition(String whereCondition)
whereCondition - as Stringpublic void rejectRequest()
throws UnauthorizedException
UnauthorizedExceptionCopyright © 2020 SAP. All Rights Reserved.