import { IExpectedAudience } from '../options/IExpected' ; import { IValidationOptions } from '../options/IValidationOptions' ; import ClaimToken from '../verifiable_credential/ClaimToken' ; import { IdTokenValidationResponse , IIdTokenValidation } from './IdTokenValidationResponse' ; /**
 * Class for id token validation
 */ export abstract class BaseIdTokenValidation implements IIdTokenValidation { param options param expectedAudience constructor ( protected options , private expectedAudience ) { } param idToken param siopDid public async validate ( idToken ) { let validationResponse = { result : true , detailedError : '' , status : 200 } ; validationResponse = await this . options . getTokenObjectDelegate ( validationResponse , idToken . rawToken ) ; if ( ! validationResponse . result ) { return validationResponse ; } validationResponse = await this . downloadConfigurationAndValidate ( validationResponse , idToken ) ; if ( ! validationResponse . result ) { return validationResponse ; } validationResponse = await this . options . checkTimeValidityOnTokenDelegate ( validationResponse ) ; if ( ! validationResponse . result ) { return validationResponse ; } validationResponse = await this . options . checkScopeValidityOnIdTokenDelegate ( validationResponse , this . expectedAudience ) ; if ( ! validationResponse . result ) { return validationResponse ; } return validationResponse ; } protected abstract downloadConfigurationAndValidate ( validationResponse , idToken ) ; }