Package org.opensaml.security.testing

# Class MockTrustEngine<TokenType>

java.lang.Object
org.opensaml.security.testing.MockTrustEngine<TokenType>

Type Parameters:
  `TokenType` - token type for trust engine

All Implemented Interfaces:
  `TrustEngine<TokenType>`

public class MockTrustEngine<TokenType> extends Object implements TrustEngine<TokenType>
Mock trust engine.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Throwable`
`throwable`
Exception to raise.
`private boolean`
`trusted`
Trusted flag.

## Constructor Summary

Constructors
Constructor
Description
`MockTrustEngine(boolean flag)`
Constructor.
`MockTrustEngine(Throwable t)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`validate(TokenType token, CriteriaSet trustBasisCriteria)`
Validates the token against trusted information obtained in an implementation-specific manner.

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

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

## Field Details

### trusted

private boolean trusted
Trusted flag.

### throwable

@Nullable private Throwable throwable
Exception to raise.

## Constructor Details

### MockTrustEngine

public MockTrustEngine(boolean flag)
Constructor.

Parameters:
  `flag` - flag controlling whether the trust engine mock should accept the input or not.

### MockTrustEngine

public MockTrustEngine(@Nullable Throwable t)
Constructor.

Parameters:
  `t` - exception to raise from mock.

## Method Details

### validate

public boolean validate(@Nonnull TokenType token, @Nullable CriteriaSet trustBasisCriteria) throws SecurityException
Validates the token against trusted information obtained in an implementation-specific manner.

Specified by:
  `validate` in interface `TrustEngine<TokenType>`
Parameters:
  `token` - security token to validate
  `trustBasisCriteria` - criteria used to describe and/or resolve the information which serves as the basis for trust evaluation
Returns:
  true iff the token is trusted and valid
Throws:
  `SecurityException` - thrown if there is a problem validating the security token