-
Notifications
You must be signed in to change notification settings - Fork 0
/
attribute-provider.model.ts
42 lines (32 loc) · 1.15 KB
/
attribute-provider.model.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { AccountParameters } from "./account-parameter.model";
import { UserInfo } from "./user-info.model";
export interface IAttributeProvider {
getUserId(userInfo: UserInfo): string | Promise<string>;
getUsername(userInfo: UserInfo): string | Promise<string>;
getFirstname(userInfo: UserInfo): string | Promise<string>;
getLastname(userInfo: UserInfo): string | Promise<string>;
getEmail(userInfo: UserInfo): string | Promise<string>;
getAccountParameters(userInfo: UserInfo): AccountParameters | Promise<AccountParameters> ;
}
export class DefaultAttributeProvider implements IAttributeProvider {
constructor() {
}
getUserId(userInfo: UserInfo): string {
throw new Error("Method not implemented.");
}
getUsername(userInfo: UserInfo): string {
return userInfo.get('preferred_username')
}
getFirstname(userInfo: UserInfo): string {
return userInfo.get('given_name');
}
getLastname(userInfo: UserInfo): string {
return userInfo.get('family_name');
}
getEmail(userInfo: UserInfo): string {
return userInfo.get('email');
}
getAccountParameters(userInfo: UserInfo): AccountParameters {
return {};
}
}