@vendasta/iam 2.0.2 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +113 -0
  3. package/bundles/vendasta-iam.umd.js +815 -1350
  4. package/bundles/vendasta-iam.umd.js.map +1 -1
  5. package/bundles/vendasta-iam.umd.min.js +2 -2
  6. package/bundles/vendasta-iam.umd.min.js.map +1 -1
  7. package/esm2015/lib/_generated/host.service.js +7 -8
  8. package/esm2015/lib/_generated/index.js +1 -1
  9. package/esm2015/lib/_internal/enums/api.enum.js +1 -1
  10. package/esm2015/lib/_internal/enums/index.js +3 -2
  11. package/esm2015/lib/_internal/enums/policies.enum.js +18 -0
  12. package/esm2015/lib/_internal/enums/resources.enum.js +1 -12
  13. package/esm2015/lib/_internal/enums/subjects.enum.js +1 -1
  14. package/esm2015/lib/_internal/enums/users.enum.js +1 -1
  15. package/esm2015/lib/_internal/iam.api.service.js +7 -9
  16. package/esm2015/lib/_internal/index.js +1 -2
  17. package/esm2015/lib/_internal/interfaces/annotations.interface.js +8 -0
  18. package/esm2015/lib/_internal/interfaces/api.interface.js +1 -1
  19. package/esm2015/lib/_internal/interfaces/attributes.interface.js +8 -0
  20. package/esm2015/lib/_internal/interfaces/field-mask.interface.js +1 -1
  21. package/esm2015/lib/_internal/interfaces/index.js +1 -1
  22. package/esm2015/lib/_internal/interfaces/policies.interface.js +3 -0
  23. package/esm2015/lib/_internal/interfaces/resources.interface.js +1 -1
  24. package/esm2015/lib/_internal/interfaces/security-logs.interface.js +1 -1
  25. package/esm2015/lib/_internal/interfaces/subjects.interface.js +1 -7
  26. package/esm2015/lib/_internal/interfaces/users.interface.js +1 -1
  27. package/esm2015/lib/_internal/objects/annotations.js +30 -0
  28. package/esm2015/lib/_internal/objects/api.js +14 -380
  29. package/esm2015/lib/_internal/objects/attributes.js +158 -0
  30. package/esm2015/lib/_internal/objects/field-mask.js +1 -4
  31. package/esm2015/lib/_internal/objects/index.js +7 -4
  32. package/esm2015/lib/_internal/objects/policies.js +264 -0
  33. package/esm2015/lib/_internal/objects/resources.js +5 -320
  34. package/esm2015/lib/_internal/objects/security-logs.js +1 -8
  35. package/esm2015/lib/_internal/objects/subjects.js +2 -232
  36. package/esm2015/lib/_internal/objects/users.js +1 -32
  37. package/esm2015/lib/_internal/user-iam.api.service.js +7 -9
  38. package/esm2015/lib/http/http.interface.js +1 -1
  39. package/esm2015/lib/http/http.js +1 -1
  40. package/esm2015/lib/http/iam.http.api.service.js +7 -9
  41. package/esm2015/lib/iam.service.js +7 -11
  42. package/esm2015/lib/index.js +1 -1
  43. package/esm2015/lib/personas/account-group.js +1 -1
  44. package/esm2015/lib/personas/base-personas.js +1 -1
  45. package/esm2015/lib/personas/developer.js +1 -1
  46. package/esm2015/lib/personas/digital-agent.js +1 -1
  47. package/esm2015/lib/personas/index.js +1 -1
  48. package/esm2015/lib/personas/partner-app.js +1 -1
  49. package/esm2015/lib/personas/partner.js +2 -1
  50. package/esm2015/lib/personas/persona-type.enum.js +1 -1
  51. package/esm2015/lib/personas/personas.js +1 -1
  52. package/esm2015/lib/personas/salesperson.js +1 -1
  53. package/esm2015/lib/personas/smb.js +1 -1
  54. package/esm2015/lib/personas/success.js +1 -1
  55. package/esm2015/lib/personas/vendor.js +1 -1
  56. package/esm2015/public_api.js +1 -1
  57. package/esm2015/vendasta-iam.js +1 -1
  58. package/fesm2015/vendasta-iam.js +377 -913
  59. package/fesm2015/vendasta-iam.js.map +1 -1
  60. package/lib/_generated/host.service.d.ts +3 -0
  61. package/lib/_internal/enums/index.d.ts +2 -1
  62. package/lib/_internal/enums/policies.enum.d.ts +9 -0
  63. package/lib/_internal/enums/resources.enum.d.ts +0 -9
  64. package/lib/_internal/iam.api.service.d.ts +3 -0
  65. package/lib/_internal/index.d.ts +0 -1
  66. package/lib/_internal/interfaces/annotations.interface.d.ts +4 -0
  67. package/lib/_internal/interfaces/api.interface.d.ts +5 -17
  68. package/lib/_internal/interfaces/attributes.interface.d.ts +26 -0
  69. package/lib/_internal/interfaces/index.d.ts +6 -3
  70. package/lib/_internal/interfaces/policies.interface.d.ts +42 -0
  71. package/lib/_internal/interfaces/resources.interface.d.ts +2 -41
  72. package/lib/_internal/interfaces/subjects.interface.d.ts +1 -26
  73. package/lib/_internal/objects/annotations.d.ts +9 -0
  74. package/lib/_internal/objects/api.d.ts +5 -23
  75. package/lib/_internal/objects/attributes.d.ts +43 -0
  76. package/lib/_internal/objects/index.d.ts +6 -3
  77. package/lib/_internal/objects/policies.d.ts +68 -0
  78. package/lib/_internal/objects/resources.d.ts +2 -65
  79. package/lib/_internal/objects/subjects.d.ts +1 -41
  80. package/lib/_internal/user-iam.api.service.d.ts +3 -0
  81. package/lib/http/iam.http.api.service.d.ts +3 -0
  82. package/lib/iam.service.d.ts +3 -0
  83. package/lib/personas/base-personas.d.ts +1 -1
  84. package/lib/personas/partner.d.ts +1 -0
  85. package/package.json +5 -3
  86. package/vendasta-iam.d.ts +1 -0
  87. package/esm2015/lib/_internal/iam-sso.api.service.js +0 -42
  88. package/lib/_internal/iam-sso.api.service.d.ts +0 -12
  89. package/vendasta-iam.metadata.json +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,101 @@
1
+ # Changelog
2
+
3
+ ## 2.2.2
4
+ - Change ng-package location in IAM_SDK
5
+
6
+ ## 2.2.1
7
+ - Version Bump (Doesn't change anything)
8
+
9
+ ## 2.2.0
10
+ - Regenerated TS SDK
11
+
12
+ ## 2.1.0
13
+ - Add canAccessRetailBilling to PartnerPersona
14
+
15
+ ## 2.0.2
16
+ - Fix ssoLogin() query param encoding
17
+
18
+ ## 2.0.1
19
+ - Set defaults for partner 'canAccess*' attributes to false, as they should be filled in by the actual persona's attributes. This will affect the values of these fields for partner users who don't have values for these attributes, but the new behaviour matches the actual values stored in IAM.
20
+
21
+ ## 2.0.0
22
+ - Tree Shakeable
23
+
24
+ ## 1.17.2
25
+ - Rebuild SDK integrity check error with the last version.
26
+
27
+ ## 1.17.1
28
+ - Fix TS SDK.
29
+
30
+ ## 1.17.0
31
+ - Add ListUser sorting by LastLoginColumn
32
+
33
+ ## 1.16.0
34
+ - Add canAccessAutomations to PartnerPersona
35
+
36
+ ## 1.15.2
37
+ - Add account_group PersonaType
38
+
39
+ ## 1.14.0
40
+ - Add `profilePicture` to DigitalAgent
41
+
42
+ ## 1.13.0
43
+ - Expose HostService so that external users can override environment if needed
44
+
45
+ ## 1.12.0
46
+ - Add `DeleteUser`
47
+
48
+ ## 1.11.0
49
+ - Add `AddMultiUserRestriction`
50
+ - Add `RemoveMultiUserRestriction`
51
+ - Add `CreateExternalID`
52
+ - Add `GetMultiExternalID`
53
+ - Add user Identifier to `AddKey` and `RemoveKey`
54
+ - Return public_keys on User
55
+
56
+ ## 1.10.1
57
+ - Fix sessionID not being returned during `login`
58
+ - Microservice returns object with key `session_id` not `sessionId`
59
+
60
+ ## 1.10.0
61
+ - Updated ListUsers endpoint with search and sort.
62
+
63
+ ## 1.9.0
64
+ - Add additional fields to the Partner Persona that are already in the attributes.
65
+
66
+ ## 1.8.0
67
+ - Expose the fromPersona method in the SDK
68
+
69
+ ## 1.7.0
70
+ - Add new Token UserIdentifier
71
+
72
+ ## 1.6.0
73
+ - Updated the SDK with addition of roles to the Users returned in ListUsers
74
+
75
+ ## 1.5.0
76
+ - Add algorithm type to AddKey, add client_key option on GetSessionForUser
77
+
78
+ ## 1.4.1
79
+ - Fix serializing namespace on ListUsers
80
+
81
+ ## 1.4.0
82
+ - Add UserFilter to the ListUsers function
83
+
84
+ ## 1.3.1
85
+ - Add userId to BasePersona
86
+
87
+ ## 1.3.0
88
+ - Add listUsers function to IAMService
89
+
90
+ ## 1.2.1
91
+ - Fix null injector error by providing IamHttpApiService
92
+
93
+ ## 1.2.0
94
+ - Add listSecurityLogs function to IAMService
95
+
96
+ ## 1.1.0
97
+ - Add getMultiUser function to IAMService
98
+
99
+ ## 1.0.0
100
+ - Transferred package from [vendasta/core](https://github.com/vendasta/frontend/blob/master/angular/projects/core/iam/CHANGELOG.md)
101
+ - See that changelog for any prior changes
package/README.md ADDED
@@ -0,0 +1,113 @@
1
+ # IAM SDK
2
+
3
+ ## Login
4
+ `login(email: string, password: string, personaType?: PersonaType, partnerId?: string): Observable<string>`
5
+
6
+ Login accepts an email and password to use to attempt to auth a user. If `personaType` isn't specified, IAM will attempt to
7
+ auth the email and password combo against any of the associated personas. If `personaType` and optionally `partnerId` are
8
+ specified, IAM will auth against that persona specifically.
9
+
10
+ ## Logout
11
+ `logout(): Observable<boolean>`
12
+
13
+ Logout will clear the user's cookies on IAM's side. Returns true if successful.
14
+
15
+ ## SSO Login
16
+ `ssoLogin(nextUrl: string, personaType: PersonaType, partnerId?: string): void`
17
+
18
+ SSOLogin will redirect the user's browser to IAM's SSOLogin page. IAM handles all of the oauth google has in place for
19
+ getting a session using your gmail account (and the whitelabeling of the domain requesting access). Once IAM is done
20
+ handling those requests, IAM will then attempt to find the persona specified in this endpoint (the `personaType` and
21
+ `partnerId` combination). If IAM fails to find a persona, it will redirect to the `nextUrl` with `error` and `status`
22
+ query params indicating why it failed. If IAM is successful in finding the appropriate persona for the request, it
23
+ will redirect to the `nextUrl` with a `session_id` query param. You will then have to take this `session_id` and set up
24
+ the user's session with it, in the same fashion you would have set up the session from the response of the `Login`
25
+ endpoint.
26
+
27
+ ## Get Subject By Session
28
+ `getSubjectBySession(sessionId: string, personaType: PersonaType, partnerId?: string): Observable<BasePersona>`
29
+
30
+ Specify the `personaType` and optionally the `partnerId` for the persona you'd like to retrieve using the `sessionId`.
31
+ This endpoint returns a `BasePersona` which is the base class that all Personas inherit. To gain access to the attributes
32
+ of a specific persona, you will need to cast the persona as the requested type.
33
+
34
+ ```typescript
35
+ import {BasePersona, PartnerPersona, PersonaType} from '@vendasta/core/iam'
36
+
37
+ this.iamClient.getSubjectBySession('...sessionId...', PersonaType.partner)
38
+ .map((persona: BasePersona) => persona as PartnerPersona)
39
+ .subscribe(...)
40
+ ```
41
+
42
+ ## Get Logged In Subject
43
+ `getLoggedInSubject(personaType: PersonaType, partnerId?: string): Observable<BasePersona>`
44
+
45
+ Works identically to getSubjectBySession except it grabs the current session being served by the SessionService.
46
+
47
+ ## List Personas
48
+ `listPersonas(sessionId: string, personaType?: PersonaType): Observable<BasePersona[]>`
49
+
50
+ Given a `sessionId`, listPersonas will find and return all available personas for the session. Optionally specify a
51
+ `personaType` to filter the results by only that type of persona. List personas will return a list of all the personas
52
+ it found. This endpoint returns `BasePersona` and thus they will need to be casted to their appropriate PersonaTypes to
53
+ gain access to the attributes.
54
+
55
+ ```typescript
56
+ import {BasePersona, PartnerPersona, PersonaType, SMBPersona} from '@vendasta/core/iam'
57
+
58
+ this.iamClient.listPersonas('...sessionId...')
59
+ .subscribe((personas: BasePersona[]) => {
60
+ for (const persona of personas) {
61
+ switch(persona.type) {
62
+ case PartnerType.partner:
63
+ const p: PartnerPersona = (persona as PartnerPersona);
64
+ ...
65
+ break;
66
+ case PartnerType.smb:
67
+ const p: SMBPersona = (persona as SMBPersona);
68
+ ...
69
+ break;
70
+ ...
71
+ }
72
+ }
73
+ });
74
+ ```
75
+
76
+ ## List Logged In Personas
77
+ `listLoggedInPersonas(personaType?: PersonaType): Observable<BasePersona[]>`
78
+
79
+ Works identically to listPersonas except it grabs the current session being served by the SessionService.
80
+
81
+ ## Get Token
82
+ `getToken(): Observable<string>`
83
+
84
+ Get token will refresh the 30 minute temporary session a user may have, returning the new `sessionId`.
85
+
86
+ ## Get Multi Users
87
+
88
+ `getMultiUsers(userIdentifiers: UserIdentifierInterface[]): Observable<User[]>`
89
+
90
+ This function takes in an array of user identifiers and converts them (via API) into their respective Users that
91
+ are stored in IAM. UserIdentifiers are an object containing one of the following:
92
+
93
+ userId - the user id of a user. This directly identifies the user in our system.
94
+ token - a token for a user signed by the platform. These tokens include: the session token from IAM (i.e. the `session` part of the `namespaced_session` UserIdentifier), as well as access token or identity tokens from SSO.
95
+
96
+ Deprecated identifiers:
97
+ namespacedEmail - an email address scoped to a namespace. A namespace is the id of a partner. Prefer to use user id instead, to avoid handling emails and for a more stable user identifier
98
+ namespacedSession - a session string scoped to a namespace. Use token instead, as sesson is valid token, and namespace is ignored.
99
+
100
+ ## List security logs
101
+
102
+ `listSecurityLogs(userId: string, cursor?: string, pageSize?: number, actionId = ''): Observable<ListSecurityLogsResponse>`
103
+
104
+ This function returns security logs for a userId passed in. This is a paged function, but the handling of paged
105
+ information is left to the implementor (for now). Use the cursor to call this function again and retrieve a new
106
+ observable of the response to your call.
107
+
108
+ ## List Users
109
+
110
+ `listUsers(namespace: string, email?: string, cursor?: string, pageSize?: number): Observable<ListUsersResponse>`
111
+
112
+ ListUsers returns users for a namespace passed in. This is a paged function, but the handling of paged information
113
+ is left to the implementor (for now). An empty namespace will return users that exist outside of a namespace.