This commit is contained in:
@ -11,8 +11,9 @@ type TokenType = 'access_token'|'refresh_token'|'part_token'|'none'
|
||||
|
||||
interface VerificationResult {
|
||||
authorized: boolean;
|
||||
valid: boolean;
|
||||
type: TokenType;
|
||||
next_module: string;
|
||||
next_module?: string;
|
||||
}
|
||||
|
||||
interface SignatureResult {
|
||||
@ -23,9 +24,9 @@ interface SignatureResult {
|
||||
class Authority {
|
||||
public verify (key: string): VerificationResult {
|
||||
const result: VerificationResult = {
|
||||
authorized: false,
|
||||
type: 'none',
|
||||
next_module: ''
|
||||
authorized: false,
|
||||
valid: false,
|
||||
type: 'none'
|
||||
};
|
||||
const data = verify_signature_get_info (
|
||||
key,
|
||||
@ -41,6 +42,7 @@ class Authority {
|
||||
if (!blacklist.is_valid (data.id))
|
||||
return result;
|
||||
|
||||
result.valid = true;
|
||||
result.authorized = result.type === 'access_token';
|
||||
result.next_module = data.obj;
|
||||
|
||||
|
Reference in New Issue
Block a user