-
Notifications
You must be signed in to change notification settings - Fork 15
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
migration to typescript #48
Conversation
resource: { | ||
name: 'Service 2 Resource', | ||
}, | ||
export async function auth0(event: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.
Similar blocks of code found in 2 locations. Consider refactoring.
resource: { | ||
name: 'Service 3 Resource', | ||
}, | ||
export async function auth0(event: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.
Similar blocks of code found in 2 locations. Consider refactoring.
|
||
import { getAuthentication } from './authorizerUtil'; | ||
|
||
function getKeycloakJSON() { | ||
function getKeycloakJSON():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.
Similar blocks of code found in 2 locations. Consider refactoring.
|
||
import { getAuthentication } from './authorizerUtil'; | ||
import { fetchData } from './restCalls'; | ||
|
||
function getKeycloakJSON() { | ||
function getKeycloakJSON():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.
Similar blocks of code found in 2 locations. Consider refactoring.
}); | ||
}); | ||
|
||
app.get('/expressServiceApi2', keycloakAdapter.getExpressMiddlewareAdapter().middleware({ |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
}, | ||
enforce: { | ||
enabled: true, | ||
export async function auth0(event: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.
Similar blocks of code found in 2 locations. Consider refactoring.
uri: 'LambdaResource123', | ||
matchingUri: true, | ||
}, | ||
export async function auth0(event: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.
Similar blocks of code found in 2 locations. Consider refactoring.
@@ -26,8 +42,8 @@ function getToken(event) { | |||
return jsonwebtoken.decode(tokenStringValue); | |||
} | |||
|
|||
export function hello(event, context, callback) { | |||
const token = getToken(event); | |||
export function hello(event:any, context:any, callback: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.
Similar blocks of code found in 2 locations. Consider refactoring.
@@ -26,8 +34,8 @@ function getToken(event) { | |||
return jsonwebtoken.decode(tokenStringValue); | |||
} | |||
|
|||
export function hello(event, context, callback) { | |||
const token = getToken(event); | |||
export function hello(event:any, context:any, callback: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.
Similar blocks of code found in 2 locations. Consider refactoring.
|
||
app.use(bodyParser.urlencoded({ extended: true })); | ||
|
||
app.get('/expressServiceApi1', keycloakAdapter.getExpressMiddlewareAdapter().middleware({ |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
typescript/cache/DefaultCache.ts
Outdated
} if (region === 'resource') { | ||
return resourceCache.get(key); | ||
} if (region === 'rpt') { | ||
return rptCache.get(key); |
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.
Avoid too many return
statements within this function.
return resources; | ||
} | ||
|
||
async matchResource(requestContent:RequestContent, enforcer?:Enforcer): Promise<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.
Function matchResource
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
return tokenJson; | ||
} | ||
|
||
async keycloakRefreshToken(token: TokenJson, |
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.
Function keycloakRefreshToken
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
} | ||
} | ||
|
||
async getRPT(requestContent: RequestContent, enforcer:Enforcer): Promise<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.
Function getRPT
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
return tokenJson; | ||
} | ||
|
||
async keycloakRefreshToken(token: TokenJson, |
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.
Function keycloakRefreshToken
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
} | ||
} | ||
|
||
async getRPT(requestContent: RequestContent, enforcer:Enforcer): Promise<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.
Function getRPT
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
return tokenJson; | ||
} | ||
|
||
async keycloakRefreshToken(token: TokenJson, |
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.
Function keycloakRefreshToken
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
} | ||
} | ||
|
||
async getRPT(requestContent: RequestContent, enforcer:Enforcer): Promise<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.
Function getRPT
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
return tokenJson; | ||
} | ||
|
||
async keycloakRefreshToken(token: TokenJson, |
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.
Function keycloakRefreshToken
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
typescript/utils/TokenUtils.ts
Outdated
|
||
import {getKeycloakUrl, getUrl} from './KeycloakUtils'; | ||
|
||
export function decodeToken(tokenString:string):JWTToken { |
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.
Function decodeToken
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
return resources; | ||
} | ||
|
||
async matchResource(requestContent:RequestContent, enforcer?:Enforcer): Promise<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.
Function matchResource
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
return resources; | ||
} | ||
|
||
async matchResource(requestContent:RequestContent, enforcer?:Enforcer): Promise<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.
Function matchResource
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
typescript/cache/DefaultCache.ts
Outdated
throw new Error('Unsupported Region'); | ||
} | ||
|
||
async put(region: string, key: string, value: any, ttl: number): Promise<void> { |
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.
Function put
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
typescript/Options.ts
Outdated
} | ||
return enf; | ||
} | ||
export function updateOptions(opts: AdapterDependencies): AdapterContent { |
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.
Function updateOptions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
typescript/Options.ts
Outdated
} | ||
return enf; | ||
} | ||
export function updateOptions(opts: AdapterDependencies): AdapterContent { |
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.
Function updateOptions
has 36 lines of code (exceeds 25 allowed). Consider refactoring.
typescript/cache/DefaultCache.ts
Outdated
throw new Error('Unsupported Region'); | ||
} | ||
|
||
put(region: string, key: string, value: any, ttl: number): void { |
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.
Function put
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
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.
The PR diff size of 11463 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 11466 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 11602 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 11740 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 11767 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 11779 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 12243 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 12487 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 15326 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 8774 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 8774 lines exceeds the maximum allowed for the inline comments feature.
Code Climate has analyzed commit 8ff57d5 and detected 0 issues on this pull request. View more on Code Climate. |
No description provided.