-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
41 type information #42
Conversation
👍 |
README.md
Outdated
@@ -30,7 +30,7 @@ import { | |||
} from 'lib-oauth-tooling'; | |||
``` | |||
|
|||
#### TokenCache(tokenConfig: any, oauthConfig: any) | |||
#### TokenCache(tokenConfig: { [key : string]: string[] }, oauthConfig: OAuthConfig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: should we move the signature out of the headline?
@@ -83,17 +83,17 @@ describe('mock tooling', () => { | |||
|
|||
// when | |||
let promise = getTokenInfo(tokeninfoEndpoint, 'foo') | |||
.then((token: any) => { | |||
.then((token: TokenInfo) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const + indent
@@ -199,7 +199,7 @@ describe('getAccessToken', () => { | |||
const responseObject = { 'access_token': '4b70510f-be1d-4f0f-b4cb-edbca2c79d41' }; | |||
|
|||
nock(host) | |||
.post('/access_token?realm=/services', (body) => { | |||
.post('/access_token?realm=/services', (body: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent
package.json
Outdated
}, | ||
"dependencies": { | ||
"body-parser": "^1.16.0", | ||
"body-parser": "^1.17.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we switch to non ^ ~ versions for the library?
src/TokenCache.ts
Outdated
@@ -57,8 +52,8 @@ class TokenCache { | |||
* @param {string} The key configured on the tokenCache instance | |||
* @return {Promise<string>} the resolved access_token | |||
*/ | |||
public resolveAccessTokenFactory(key: string): () => Promise<string> { | |||
return () => this | |||
public resolveAccessTokenFactory(key : string) : () => Promise < string > { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public resolveAccessTokenFactory(key: string): () => Promise<string> {
src/TokenCache.ts
Outdated
public resolveAccessTokenFactory(key: string): () => Promise<string> { | ||
return () => this | ||
public resolveAccessTokenFactory(key : string) : () => Promise < string > { | ||
return() => this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return ()
src/TokenCache.ts
Outdated
@@ -70,36 +65,32 @@ class TokenCache { | |||
* @param tokenName | |||
* @returns {Promise<T>} | |||
*/ | |||
get(tokenName: string): Promise<any> { | |||
get(tokenName : string) : Promise <TokenInfo> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get(tokenName: string): Promise<TokenInfo>
src/TokenCache.ts
Outdated
}) | ||
.then((tokenInfo: any) => { | ||
return getTokenInfo(this.oauthConfig.tokenInfoEndpoint, token.access_token); | ||
}).then((tokenInfo : TokenInfo) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
})
.then
src/TokenCache.ts
Outdated
*/ | ||
refreshToken(tokenName: string): Promise<any> { | ||
refreshToken(tokenName : string) : Promise <TokenInfo> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces
src/TokenCache.ts
Outdated
@@ -127,13 +118,17 @@ class TokenCache { | |||
* | |||
* @returns {Promise<T>} | |||
*/ | |||
refreshAllTokens(): Promise<any> { | |||
refreshAllTokens() : Promise <{ [key : string]: TokenInfo }> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces
src/TokenCache.ts
Outdated
}); | ||
return getTokenInfo(this.oauthConfig.tokenInfoEndpoint, token.access_token).then(validatedToken => { | ||
return Promise.resolve(validatedToken); | ||
}).catch(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\n
src/TokenCache.ts
Outdated
@@ -144,7 +139,7 @@ class TokenCache { | |||
* @param tokenName | |||
* @returns {Promise<T>} | |||
*/ | |||
private validateToken(tokenName: string): Promise<any> { | |||
private validateToken(tokenName : string) : Promise <TokenInfo> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces
src/TokenCache.ts
Outdated
export { | ||
TokenCache | ||
}; | ||
export {TokenCache}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like it was or
export { TokenCache };
src/express-tooling.ts
Outdated
@@ -77,7 +77,7 @@ function handleOAuthRequestMiddleware(options: any) { | |||
return function(req: any, res: any, next: Function) { | |||
|
|||
// Skip OAuth validation for paths marked as public | |||
if (options.publicEndpoints && match(req.originalUrl, options.publicEndpoints)) { | |||
if (options.publicEndpoints && match(req.originalUrl, new Set(options.publicEndpoints))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent
expect(token).to.equal(validAuthToken); | ||
return getTokenInfo(tokeninfoEndpoint, 'foo'); | ||
}) | ||
.then((token : TokenInfo) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space
src/oauth-tooling.ts
Outdated
const userData = JSON.parse(credentials[0]); | ||
const clientData = JSON.parse(credentials[1]); | ||
|
||
let bodyParameters: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe create new issue for new type
👍 |
👍 |
close #41