mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
add missing scopeSeparator option and tests
This commit is contained in:
Vendored
+1
@@ -67,6 +67,7 @@ declare namespace OAuth2Strategy {
|
||||
callbackURL?: string;
|
||||
customHeaders?: OutgoingHttpHeaders;
|
||||
scope?: string | string[];
|
||||
scopeSeparator?: string;
|
||||
sessionKey?: string;
|
||||
store?: StateStore;
|
||||
state?: any;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import OAuth2Strategy = require('passport-oauth2');
|
||||
import { Strategy, StrategyOptions, StrategyOptionsWithRequest, VerifyCallback, AuthorizationError, TokenError, InternalOAuthError } from 'passport-oauth2';
|
||||
import { Strategy, StrategyOptions, StrategyOptionsWithRequest, VerifyCallback, AuthorizationError, TokenError, InternalOAuthError, Metadata, StateStore, StateStoreStoreCallback, StateStoreVerifyCallback } from 'passport-oauth2';
|
||||
import { Strategy as PassportStrategy } from 'passport';
|
||||
import { Request } from 'express';
|
||||
|
||||
@@ -56,3 +56,34 @@ class MyStrategy extends OAuth2Strategy {
|
||||
this._oauth2.get('http://www.example.com/profile', 'token', (err, result, response) => response);
|
||||
}
|
||||
}
|
||||
|
||||
const metadata: Metadata = {
|
||||
authorizationURL: 'http://www.example.com/auth',
|
||||
clientID: 'dummy',
|
||||
tokenURL: 'http://www.example.com/token'
|
||||
}
|
||||
|
||||
class MyStore implements StateStore {
|
||||
store(req: Request, meta: StateStoreStoreCallback | Metadata, callback?: StateStoreStoreCallback): void {}
|
||||
verify(req: Request, state: string, meta: StateStoreVerifyCallback | Metadata, callback?: StateStoreVerifyCallback): void {}
|
||||
}
|
||||
|
||||
const myStore = new MyStore;
|
||||
|
||||
const strategyOptions3: StrategyOptions = {
|
||||
authorizationURL: 'http://www.example.com/auth',
|
||||
clientID: 'dummy',
|
||||
clientSecret: 'secret',
|
||||
tokenURL: 'http://www.example.com/token',
|
||||
callbackURL: 'http://www.example.com/callback',
|
||||
customHeaders: {
|
||||
'content-type': 'text/html'
|
||||
},
|
||||
scope: ['scope1', 'scope2'],
|
||||
scopeSeparator: ' ',
|
||||
sessionKey: 'oauth',
|
||||
state: {id: 1},
|
||||
store: myStore
|
||||
};
|
||||
|
||||
const strategy5: Strategy = new Strategy(strategyOptions3, verifyFunction2);
|
||||
|
||||
Reference in New Issue
Block a user