Package org.teiid.dqp.internal.process
Class DefaultAuthorizationValidator
- java.lang.Object
-
- org.teiid.dqp.internal.process.DefaultAuthorizationValidator
-
- All Implemented Interfaces:
AuthorizationValidator
public class DefaultAuthorizationValidator extends Object implements AuthorizationValidator
The default Teiid authorization validator
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.teiid.dqp.internal.process.AuthorizationValidator
AuthorizationValidator.CommandType
-
-
Field Summary
Fields Modifier and Type Field Description static StringIGNORE_UNAUTHORIZED_ASTERISK
-
Constructor Summary
Constructors Constructor Description DefaultAuthorizationValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasRole(String roleName, CommandContext commandContext)Uses the context or other information to determine if the current user has the given role name.booleanisAccessible(AbstractMetadataRecord record, CommandContext commandContext)Determines if the metadata record is accessible in system queriesvoidsetMetadataRequiresPermission(boolean metadataRequiresPermission)voidsetPolicyDecider(PolicyDecider policyDecider)booleanvalidate(String[] originalSql, Command command, QueryMetadataInterface metadata, CommandContext commandContext, AuthorizationValidator.CommandType commandType)Validates the given command.
-
-
-
Field Detail
-
IGNORE_UNAUTHORIZED_ASTERISK
public static final String IGNORE_UNAUTHORIZED_ASTERISK
- See Also:
- Constant Field Values
-
-
Method Detail
-
setMetadataRequiresPermission
public void setMetadataRequiresPermission(boolean metadataRequiresPermission)
-
validate
public boolean validate(String[] originalSql, Command command, QueryMetadataInterface metadata, CommandContext commandContext, AuthorizationValidator.CommandType commandType) throws QueryValidatorException, TeiidComponentException
Description copied from interface:AuthorizationValidatorValidates the given command. If the command is not aAuthorizationValidator.CommandType.USERcommand, the command object should not be modified. Any modification must be fully resolved using the associatedQueryMetadataInterface. Returning true for aAuthorizationValidator.CommandType.PREPAREDorAuthorizationValidator.CommandType.CACHEDcommands means that the matching prepared plan or cache entry will not be used.- Specified by:
validatein interfaceAuthorizationValidator- Parameters:
originalSql- array of commands will typically contain only a single string, but may have multiple for batched updates.command- the parsed and resolved command.- Returns:
- true if the USER command was modified, or if the non-USER command should be modified.
- Throws:
QueryValidatorExceptionTeiidComponentException
-
hasRole
public boolean hasRole(String roleName, CommandContext commandContext)
Description copied from interface:AuthorizationValidatorUses the context or other information to determine if the current user has the given role name.- Specified by:
hasRolein interfaceAuthorizationValidator- Returns:
- true if the current user has the given role
-
setPolicyDecider
public void setPolicyDecider(PolicyDecider policyDecider)
-
isAccessible
public boolean isAccessible(AbstractMetadataRecord record, CommandContext commandContext)
Description copied from interface:AuthorizationValidatorDetermines if the metadata record is accessible in system queries- Specified by:
isAccessiblein interfaceAuthorizationValidator- Returns:
-
-