@expressive-analytics/deep-thought-authentication
Version:
Typescript conversion of Deep Thought Authentication
15 lines (14 loc) • 539 B
text/typescript
import {DTBasicVerifier,DTHTTPError} from '@expressive-analytics/deep-thought-service'
import {DTStore} from '@expressive-analytics/deep-thought-js'
export class DTSecureVerifier extends DTBasicVerifier {
protected auth_url
constructor(db?:DTStore){
super(db)
this.auth_url = "login"
}
verify(action: any, token?: string): boolean {
if(super.verify(action,token) && this.userID() > 0) // make sure we have a valid user
return true
throw new DTHTTPError(278,'HTTP/1.1 278 Client Redirect',this.auth_url)
}
}