chore: fixing some code review comments
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -136,7 +136,7 @@ export const SingleSignInPage = ({
|
||||
|
||||
const profile = await authApi.getProfile();
|
||||
onSignInSuccess(
|
||||
UserIdentity.from({
|
||||
UserIdentity.create({
|
||||
identity: identityResponse.identity,
|
||||
authApi,
|
||||
profile,
|
||||
|
||||
@@ -32,11 +32,11 @@ export class UserIdentity implements IdentityApi {
|
||||
return new GuestUserIdentity();
|
||||
}
|
||||
|
||||
static fromLegacy({ result }: { result: SignInResult }) {
|
||||
static fromLegacy(result: SignInResult) {
|
||||
return LegacyUserIdentity.fromResult(result);
|
||||
}
|
||||
|
||||
static from(options: {
|
||||
static create(options: {
|
||||
identity: BackstageUserIdentity;
|
||||
authApi: ProfileInfoApi & BackstageIdentityApi & SessionApi;
|
||||
/**
|
||||
|
||||
@@ -46,7 +46,7 @@ const Component: ProviderComponent = ({ onSignInSuccess }) => {
|
||||
const profile = await auth0AuthApi.getProfile();
|
||||
|
||||
onSignInSuccess(
|
||||
UserIdentity.from({
|
||||
UserIdentity.create({
|
||||
identity: identityResponse.identity,
|
||||
authApi: auth0AuthApi,
|
||||
profile,
|
||||
@@ -85,7 +85,7 @@ const loader: ProviderLoader = async apis => {
|
||||
}
|
||||
|
||||
const profile = await auth0AuthApi.getProfile();
|
||||
return UserIdentity.from({
|
||||
return UserIdentity.create({
|
||||
identity: identityResponse.identity,
|
||||
authApi: auth0AuthApi,
|
||||
profile,
|
||||
|
||||
@@ -48,7 +48,7 @@ const Component: ProviderComponent = ({ config, onSignInSuccess }) => {
|
||||
const profile = await authApi.getProfile();
|
||||
|
||||
onSignInSuccess(
|
||||
UserIdentity.from({
|
||||
UserIdentity.create({
|
||||
identity: identityResponse.identity,
|
||||
profile,
|
||||
authApi,
|
||||
@@ -89,7 +89,7 @@ const loader: ProviderLoader = async (apis, apiRef) => {
|
||||
|
||||
const profile = await authApi.getProfile();
|
||||
|
||||
return UserIdentity.from({
|
||||
return UserIdentity.create({
|
||||
identity: identityResponse.identity,
|
||||
profile,
|
||||
authApi,
|
||||
|
||||
@@ -72,11 +72,9 @@ const Component: ProviderComponent = ({ onSignInSuccess }) => {
|
||||
const handleResult = ({ userId }: Data) => {
|
||||
onSignInSuccess(
|
||||
UserIdentity.fromLegacy({
|
||||
result: {
|
||||
userId,
|
||||
profile: {
|
||||
email: `${userId}@example.com`,
|
||||
},
|
||||
userId,
|
||||
profile: {
|
||||
email: `${userId}@example.com`,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -188,7 +188,7 @@ export type BackstageUserIdentity = {
|
||||
};
|
||||
|
||||
/**
|
||||
* A (user id, token) pair.
|
||||
* Token and Identity response, with the users claims in the Identity.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
|
||||
@@ -44,3 +44,5 @@ export type {
|
||||
BackstageIdentityResponse,
|
||||
ProfileInfo,
|
||||
} from './types';
|
||||
|
||||
export { decorateWithIdentity } from './decorateWithIdentity';
|
||||
|
||||
@@ -205,6 +205,8 @@ export class OidcAuthProvider implements OAuthHandlers {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user