-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename DefaultAuthAdapter to FakeAuthAdapter, run prettier
- Loading branch information
Showing
5 changed files
with
35 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 6 additions & 7 deletions
13
...kages/auth/adapters/DefaultAuthAdapter.ts → ...packages/auth/adapters/FakeAuthAdapter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
import { getEnv } from '../../../env.js'; | ||
import type { AuthAdapter, ValidateResponse } from "../types.js"; | ||
import type { AuthAdapter, ValidateResponse } from '../types.js'; | ||
|
||
export const DefaultAuthAdapter: AuthAdapter = { | ||
export const FakeAuthAdapter: AuthAdapter = { | ||
logout: async (): Promise<boolean> => true, | ||
validate: async (): Promise<ValidateResponse> => { | ||
const { AUTH_UI_URL } = getEnv(); | ||
return { | ||
message: "SSO token auth is disabled", | ||
message: 'SSO token auth is disabled', | ||
redirectURL: AUTH_UI_URL, | ||
success: false, | ||
} | ||
} | ||
} | ||
|
||
}; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
import { getEnv } from '../../../env.js'; | ||
import { generateJwt, getUserRoles } from "../functions.js"; | ||
import type { AuthAdapter, ValidateResponse } from "../types.js"; | ||
import { generateJwt, getUserRoles } from '../functions.js'; | ||
import type { AuthAdapter, ValidateResponse } from '../types.js'; | ||
|
||
export const NoAuthAdapter: AuthAdapter = { | ||
logout: async (): Promise<boolean> => true, | ||
validate: async (): Promise<ValidateResponse> => { | ||
|
||
const { DEFAULT_ROLE_NO_AUTH, ALLOWED_ROLES_NO_AUTH } = getEnv(); | ||
|
||
console.log("auth disabled, returning default roles") | ||
const userId = "default_user"; | ||
const { allowed_roles, default_role } = await getUserRoles(userId, DEFAULT_ROLE_NO_AUTH, ALLOWED_ROLES_NO_AUTH) | ||
console.log('auth disabled, returning default roles'); | ||
const userId = 'default_user'; | ||
const { allowed_roles, default_role } = await getUserRoles(userId, DEFAULT_ROLE_NO_AUTH, ALLOWED_ROLES_NO_AUTH); | ||
|
||
return { | ||
message: userId, | ||
success: true, | ||
token: generateJwt(userId, default_role, allowed_roles) ?? undefined, | ||
}; | ||
} | ||
} | ||
|
||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters