mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-06 04:26:57 +00:00
fix(ui): capture and update profile info for oidc users (#19024)
This commit is contained in:
parent
15e64b5a12
commit
ef5f274b11
@ -293,7 +293,7 @@ export const getNameFromUserData = (
|
||||
}
|
||||
}
|
||||
|
||||
return { name: userName, email: email };
|
||||
return { name: userName, email: email, picture: user.picture };
|
||||
};
|
||||
|
||||
export const isProtectedRoute = (pathname: string) => {
|
||||
|
||||
@ -23,12 +23,13 @@ const userProfile = {
|
||||
|
||||
describe('Test Auth Provider utils', () => {
|
||||
it('getNameFromUserData should return name and email from claim: preferred_username', () => {
|
||||
const { name, email } = getNameFromUserData(userProfile, [
|
||||
const { name, email, picture } = getNameFromUserData(userProfile, [
|
||||
'preferred_username',
|
||||
]);
|
||||
|
||||
expect(name).toEqual('i_am_preferred_username');
|
||||
expect(email).toEqual('i_am_preferred_username@');
|
||||
expect(picture).toEqual('');
|
||||
});
|
||||
|
||||
it('getNameFromUserData should return name and email from claim: email', () => {
|
||||
@ -99,6 +100,18 @@ describe('Test Auth Provider utils', () => {
|
||||
expect(name).toEqual('i_am_preferred_username');
|
||||
expect(email).toEqual('i_am_preferred_username@test.com');
|
||||
});
|
||||
|
||||
it('getNameFromUserData should return picture details as it is', () => {
|
||||
const { name, email, picture } = getNameFromUserData(
|
||||
{ ...userProfile, picture: 'test_picture' },
|
||||
['preferred_username', 'email', 'sub'],
|
||||
'test.com'
|
||||
);
|
||||
|
||||
expect(name).toEqual('i_am_preferred_username');
|
||||
expect(email).toEqual('i_am_preferred_username@test.com');
|
||||
expect(picture).toEqual('test_picture');
|
||||
});
|
||||
});
|
||||
|
||||
import { OidcUser } from '../components/Auth/AuthProviders/AuthProvider.interface';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user