Package org.codehaus.groovy.control.customizers

# Class SecureASTCustomizer.SecuringCodeVisitor

java.lang.Object
org.codehaus.groovy.control.customizers.SecureASTCustomizer.SecuringCodeVisitor

All Implemented Interfaces:
  `GroovyCodeVisitor`

Enclosing class:
  SecureASTCustomizer

protected class SecureASTCustomizer.SecuringCodeVisitor extends Object implements GroovyCodeVisitor
This visitor directly implements the `GroovyCodeVisitor` interface instead of using the `CodeVisitorSupport` class to make sure that future features of the language gets managed by this visitor. Thus, adding a new feature would result in a compilation error if this visitor is not updated.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `SecuringCodeVisitor()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `assertExpressionAuthorized(Expression expression)`
  Checks that a given expression is either in the allowed list or not in the disallowed list.
  `protected void`
  `assertStatementAuthorized(Statement statement)`
  Checks that a given statement is either in the allowed list or not in the disallowed list.
  `protected void`
  `assertTokenAuthorized(Token token)`
  Checks that a given token is either in the allowed list or not in the disallowed list.
  `protected ClassNode`
  `getExpressionType(ClassNode objectExpressionType)`
  `void`
  `visitArgumentlistExpression(ArgumentListExpression expression)`
  `void`
  `visitArrayExpression(ArrayExpression expression)`
  `void`
  `visitAssertStatement(AssertStatement statement)`
  `void`
  `visitAttributeExpression(AttributeExpression expression)`
  `void`
  `visitBinaryExpression(BinaryExpression expression)`
  `void`
  `visitBitwiseNegationExpression(BitwiseNegationExpression expression)`
  `void`
  `visitBlockStatement(BlockStatement block)`
  `void`
  `visitBooleanExpression(BooleanExpression expression)`
  `void`
  `visitBreakStatement(BreakStatement statement)`
  `void`
  `visitBytecodeExpression(BytecodeExpression expression)`
  `void`
  `visitCaseStatement(CaseStatement statement)`
  `void`
  `visitCastExpression(CastExpression expression)`
  `void`
  `visitCatchStatement(CatchStatement statement)`
  `void`
  `visitClassExpression(ClassExpression expression)`
  `void`
  `visitClosureExpression(ClosureExpression expression)`
  `void`
  `visitClosureListExpression(ClosureListExpression closureListExpression)`
  `void`
  `visitConstantExpression(ConstantExpression expression)`
  `void`
  `visitConstructorCallExpression(ConstructorCallExpression call)`
  `void`
  `visitContinueStatement(ContinueStatement statement)`
  `void`
  `visitDeclarationExpression(DeclarationExpression expression)`
  `void`
  `visitDoWhileLoop(DoWhileStatement loop)`
  `void`
  `visitEmptyStatement(EmptyStatement statement)`
  `void`
  `visitExpressionStatement(ExpressionStatement statement)`
  `void`
  `visitFieldExpression(FieldExpression expression)`
  `void`
  `visitForLoop(ForStatement forLoop)`
  `void`
  `visitGStringExpression(GStringExpression expression)`
  `void`
  `visitIfElse(IfStatement ifElse)`
  `void`
  `visitLambdaExpression(LambdaExpression expression)`
  `void`
  `visitListExpression(ListExpression expression)`
  `void`
  `visitMapEntryExpression(MapEntryExpression expression)`
  `void`
  `visitMapExpression(MapExpression expression)`
  `void`
  `visitMethodCallExpression(MethodCallExpression call)`
  `void`
  `visitMethodPointerExpression(MethodPointerExpression expression)`
  `void`
  `visitMethodReferenceExpression(MethodReferenceExpression expression)`
  `void`
  `visitNotExpression(NotExpression expression)`
  `void`
  `visitPostfixExpression(PostfixExpression expression)`
  `void`
  `visitPrefixExpression(PrefixExpression expression)`
  `void`
  `visitPropertyExpression(PropertyExpression expression)`
  `void`
  `visitRangeExpression(RangeExpression expression)`
  `void`
  `visitReturnStatement(ReturnStatement statement)`
  `void`
  `visitShortTernaryExpression(ElvisOperatorExpression expression)`
  `void`
  `visitSpreadExpression(SpreadExpression expression)`
  `void`
  `visitSpreadMapExpression(SpreadMapExpression expression)`
  `void`
  `visitStaticMethodCallExpression(StaticMethodCallExpression call)`
  `void`
  `visitSwitch(SwitchStatement statement)`
  `void`
  `visitSynchronizedStatement(SynchronizedStatement statement)`
  `void`
  `visitTernaryExpression(TernaryExpression expression)`
  `void`
  `visitThrowStatement(ThrowStatement statement)`
  `void`
  `visitTryCatchFinally(TryCatchStatement statement)`
  `void`
  `visitTupleExpression(TupleExpression expression)`
  `void`
  `visitUnaryMinusExpression(UnaryMinusExpression expression)`
  `void`
  `visitUnaryPlusExpression(UnaryPlusExpression expression)`
  `void`
  `visitVariableExpression(VariableExpression expression)`
  `void`
  `visitWhileLoop(WhileStatement loop)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.codehaus.groovy.ast.GroovyCodeVisitor

  `visit, visit, visitEmptyExpression, visitListOfExpressions`

- ## Constructor Details

  - ### SecuringCodeVisitor

    protected SecuringCodeVisitor()

- ## Method Details

  - ### assertStatementAuthorized

    protected void assertStatementAuthorized(Statement statement) throws SecurityException
    Checks that a given statement is either in the allowed list or not in the disallowed list.
    Parameters:
      `statement` - the statement to be checked
    Throws:
      `SecurityException` - if usage of this statement class is forbidden

  - ### assertExpressionAuthorized

    protected void assertExpressionAuthorized(Expression expression) throws SecurityException
    Checks that a given expression is either in the allowed list or not in the disallowed list.
    Parameters:
      `expression` - the expression to be checked
    Throws:
      `SecurityException` - if usage of this expression class is forbidden

  - ### getExpressionType

    protected ClassNode getExpressionType(ClassNode objectExpressionType)

  - ### assertTokenAuthorized

    protected void assertTokenAuthorized(Token token) throws SecurityException
    Checks that a given token is either in the allowed list or not in the disallowed list.
    Parameters:
      `token` - the token to be checked
    Throws:
      `SecurityException` - if usage of this token is forbidden

  - ### visitBlockStatement

    public void visitBlockStatement(BlockStatement block)
    Specified by:
      `visitBlockStatement` in interface `GroovyCodeVisitor`

  - ### visitForLoop

    public void visitForLoop(ForStatement forLoop)
    Specified by:
      `visitForLoop` in interface `GroovyCodeVisitor`

  - ### visitWhileLoop

    public void visitWhileLoop(WhileStatement loop)
    Specified by:
      `visitWhileLoop` in interface `GroovyCodeVisitor`

  - ### visitDoWhileLoop

    public void visitDoWhileLoop(DoWhileStatement loop)
    Specified by:
      `visitDoWhileLoop` in interface `GroovyCodeVisitor`

  - ### visitIfElse

    public void visitIfElse(IfStatement ifElse)
    Specified by:
      `visitIfElse` in interface `GroovyCodeVisitor`

  - ### visitExpressionStatement

    public void visitExpressionStatement(ExpressionStatement statement)
    Specified by:
      `visitExpressionStatement` in interface `GroovyCodeVisitor`

  - ### visitReturnStatement

    public void visitReturnStatement(ReturnStatement statement)
    Specified by:
      `visitReturnStatement` in interface `GroovyCodeVisitor`

  - ### visitAssertStatement

    public void visitAssertStatement(AssertStatement statement)
    Specified by:
      `visitAssertStatement` in interface `GroovyCodeVisitor`

  - ### visitTryCatchFinally

    public void visitTryCatchFinally(TryCatchStatement statement)
    Specified by:
      `visitTryCatchFinally` in interface `GroovyCodeVisitor`

  - ### visitEmptyStatement

    public void visitEmptyStatement(EmptyStatement statement)
    Specified by:
      `visitEmptyStatement` in interface `GroovyCodeVisitor`

  - ### visitSwitch

    public void visitSwitch(SwitchStatement statement)
    Specified by:
      `visitSwitch` in interface `GroovyCodeVisitor`

  - ### visitCaseStatement

    public void visitCaseStatement(CaseStatement statement)
    Specified by:
      `visitCaseStatement` in interface `GroovyCodeVisitor`

  - ### visitBreakStatement

    public void visitBreakStatement(BreakStatement statement)
    Specified by:
      `visitBreakStatement` in interface `GroovyCodeVisitor`

  - ### visitContinueStatement

    public void visitContinueStatement(ContinueStatement statement)
    Specified by:
      `visitContinueStatement` in interface `GroovyCodeVisitor`

  - ### visitThrowStatement

    public void visitThrowStatement(ThrowStatement statement)
    Specified by:
      `visitThrowStatement` in interface `GroovyCodeVisitor`

  - ### visitSynchronizedStatement

    public void visitSynchronizedStatement(SynchronizedStatement statement)
    Specified by:
      `visitSynchronizedStatement` in interface `GroovyCodeVisitor`

  - ### visitCatchStatement

    public void visitCatchStatement(CatchStatement statement)
    Specified by:
      `visitCatchStatement` in interface `GroovyCodeVisitor`

  - ### visitMethodCallExpression

    public void visitMethodCallExpression(MethodCallExpression call)
    Specified by:
      `visitMethodCallExpression` in interface `GroovyCodeVisitor`

  - ### visitStaticMethodCallExpression

    public void visitStaticMethodCallExpression(StaticMethodCallExpression call)
    Specified by:
      `visitStaticMethodCallExpression` in interface `GroovyCodeVisitor`

  - ### visitConstructorCallExpression

    public void visitConstructorCallExpression(ConstructorCallExpression call)
    Specified by:
      `visitConstructorCallExpression` in interface `GroovyCodeVisitor`

  - ### visitTernaryExpression

    public void visitTernaryExpression(TernaryExpression expression)
    Specified by:
      `visitTernaryExpression` in interface `GroovyCodeVisitor`

  - ### visitShortTernaryExpression

    public void visitShortTernaryExpression(ElvisOperatorExpression expression)
    Specified by:
      `visitShortTernaryExpression` in interface `GroovyCodeVisitor`

  - ### visitBinaryExpression

    public void visitBinaryExpression(BinaryExpression expression)
    Specified by:
      `visitBinaryExpression` in interface `GroovyCodeVisitor`

  - ### visitPrefixExpression

    public void visitPrefixExpression(PrefixExpression expression)
    Specified by:
      `visitPrefixExpression` in interface `GroovyCodeVisitor`

  - ### visitPostfixExpression

    public void visitPostfixExpression(PostfixExpression expression)
    Specified by:
      `visitPostfixExpression` in interface `GroovyCodeVisitor`

  - ### visitBooleanExpression

    public void visitBooleanExpression(BooleanExpression expression)
    Specified by:
      `visitBooleanExpression` in interface `GroovyCodeVisitor`

  - ### visitClosureExpression

    public void visitClosureExpression(ClosureExpression expression)
    Specified by:
      `visitClosureExpression` in interface `GroovyCodeVisitor`

  - ### visitLambdaExpression

    public void visitLambdaExpression(LambdaExpression expression)
    Specified by:
      `visitLambdaExpression` in interface `GroovyCodeVisitor`

  - ### visitTupleExpression

    public void visitTupleExpression(TupleExpression expression)
    Specified by:
      `visitTupleExpression` in interface `GroovyCodeVisitor`

  - ### visitMapExpression

    public void visitMapExpression(MapExpression expression)
    Specified by:
      `visitMapExpression` in interface `GroovyCodeVisitor`

  - ### visitMapEntryExpression

    public void visitMapEntryExpression(MapEntryExpression expression)
    Specified by:
      `visitMapEntryExpression` in interface `GroovyCodeVisitor`

  - ### visitListExpression

    public void visitListExpression(ListExpression expression)
    Specified by:
      `visitListExpression` in interface `GroovyCodeVisitor`

  - ### visitRangeExpression

    public void visitRangeExpression(RangeExpression expression)
    Specified by:
      `visitRangeExpression` in interface `GroovyCodeVisitor`

  - ### visitPropertyExpression

    public void visitPropertyExpression(PropertyExpression expression)
    Specified by:
      `visitPropertyExpression` in interface `GroovyCodeVisitor`

  - ### visitAttributeExpression

    public void visitAttributeExpression(AttributeExpression expression)
    Specified by:
      `visitAttributeExpression` in interface `GroovyCodeVisitor`

  - ### visitFieldExpression

    public void visitFieldExpression(FieldExpression expression)
    Specified by:
      `visitFieldExpression` in interface `GroovyCodeVisitor`

  - ### visitMethodPointerExpression

    public void visitMethodPointerExpression(MethodPointerExpression expression)
    Specified by:
      `visitMethodPointerExpression` in interface `GroovyCodeVisitor`

  - ### visitMethodReferenceExpression

    public void visitMethodReferenceExpression(MethodReferenceExpression expression)
    Specified by:
      `visitMethodReferenceExpression` in interface `GroovyCodeVisitor`

  - ### visitConstantExpression

    public void visitConstantExpression(ConstantExpression expression)
    Specified by:
      `visitConstantExpression` in interface `GroovyCodeVisitor`

  - ### visitClassExpression

    public void visitClassExpression(ClassExpression expression)
    Specified by:
      `visitClassExpression` in interface `GroovyCodeVisitor`

  - ### visitVariableExpression

    public void visitVariableExpression(VariableExpression expression)
    Specified by:
      `visitVariableExpression` in interface `GroovyCodeVisitor`

  - ### visitDeclarationExpression

    public void visitDeclarationExpression(DeclarationExpression expression)
    Specified by:
      `visitDeclarationExpression` in interface `GroovyCodeVisitor`

  - ### visitGStringExpression

    public void visitGStringExpression(GStringExpression expression)
    Specified by:
      `visitGStringExpression` in interface `GroovyCodeVisitor`

  - ### visitArrayExpression

    public void visitArrayExpression(ArrayExpression expression)
    Specified by:
      `visitArrayExpression` in interface `GroovyCodeVisitor`

  - ### visitSpreadExpression

    public void visitSpreadExpression(SpreadExpression expression)
    Specified by:
      `visitSpreadExpression` in interface `GroovyCodeVisitor`

  - ### visitSpreadMapExpression

    public void visitSpreadMapExpression(SpreadMapExpression expression)
    Specified by:
      `visitSpreadMapExpression` in interface `GroovyCodeVisitor`

  - ### visitNotExpression

    public void visitNotExpression(NotExpression expression)
    Specified by:
      `visitNotExpression` in interface `GroovyCodeVisitor`

  - ### visitUnaryMinusExpression

    public void visitUnaryMinusExpression(UnaryMinusExpression expression)
    Specified by:
      `visitUnaryMinusExpression` in interface `GroovyCodeVisitor`

  - ### visitUnaryPlusExpression

    public void visitUnaryPlusExpression(UnaryPlusExpression expression)
    Specified by:
      `visitUnaryPlusExpression` in interface `GroovyCodeVisitor`

  - ### visitBitwiseNegationExpression

    public void visitBitwiseNegationExpression(BitwiseNegationExpression expression)
    Specified by:
      `visitBitwiseNegationExpression` in interface `GroovyCodeVisitor`

  - ### visitCastExpression

    public void visitCastExpression(CastExpression expression)
    Specified by:
      `visitCastExpression` in interface `GroovyCodeVisitor`

  - ### visitArgumentlistExpression

    public void visitArgumentlistExpression(ArgumentListExpression expression)
    Specified by:
      `visitArgumentlistExpression` in interface `GroovyCodeVisitor`

  - ### visitClosureListExpression

    public void visitClosureListExpression(ClosureListExpression closureListExpression)
    Specified by:
      `visitClosureListExpression` in interface `GroovyCodeVisitor`

  - ### visitBytecodeExpression

    public void visitBytecodeExpression(BytecodeExpression expression)
    Specified by:
      `visitBytecodeExpression` in interface `GroovyCodeVisitor`