@keycloakify/angular 0.0.11 → 0.1.1

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 (61) hide show
  1. package/bin/108.index.js +242 -0
  2. package/bin/338.index.js +104 -54
  3. package/bin/402.index.js +1250 -0
  4. package/bin/758.index.js +777 -53
  5. package/bin/{925.index.js → 84.index.js} +124 -624
  6. package/bin/main.js +59 -4
  7. package/package.json +1 -1
  8. package/src/bin/add-story.ts +126 -0
  9. package/src/bin/eject-page.ts +49 -11
  10. package/src/bin/initialize-account-theme/boilerplate/KcContextMock.ts +47 -1
  11. package/src/bin/main.ts +2 -4
  12. package/src/bin/tools/nodeModulesBinDirPath.ts +38 -0
  13. package/src/bin/tools/runPrettier.ts +89 -0
  14. package/src/bin/tools/transformCodebase_async.ts +89 -0
  15. package/src/bin/update-kc-gen.ts +20 -15
  16. package/stories/account/pages/account.stories.ts +133 -0
  17. package/stories/account/pages/applications.stories.ts +196 -0
  18. package/stories/account/pages/federated-identity.stories.ts +78 -0
  19. package/stories/account/pages/log.stories.ts +147 -0
  20. package/stories/account/pages/password.stories.ts +104 -0
  21. package/stories/account/pages/sessions.stories.ts +143 -0
  22. package/stories/account/pages/totp.stories.ts +100 -0
  23. package/stories/login/pages/code.stories.ts +51 -0
  24. package/stories/login/pages/delete-account-confirm.stories.ts +43 -0
  25. package/stories/login/pages/delete-credential.stories.ts +56 -0
  26. package/stories/login/pages/error.stories.ts +56 -0
  27. package/stories/login/pages/frontchannel-logout.stories.ts +26 -0
  28. package/stories/login/pages/idp-review-user-profile.stories.ts +60 -0
  29. package/stories/login/pages/info.stories.ts +94 -0
  30. package/stories/login/pages/login-config-totp.stories.ts +57 -0
  31. package/stories/login/pages/login-device-verify-user-code.stories.ts +14 -0
  32. package/stories/login/pages/login-idp-link-confirm-override.stories.ts +17 -0
  33. package/stories/login/pages/login-idp-link-confirm.stories.ts +103 -0
  34. package/stories/login/pages/login-idp-link-email.stories.ts +102 -0
  35. package/stories/login/pages/login-oauth-grant.stories.ts +68 -0
  36. package/stories/login/pages/login-oauth2-device-verify-user-code.stories.ts +15 -0
  37. package/stories/login/pages/login-otp.stories.ts +94 -0
  38. package/stories/login/pages/login-page-expired.stories.ts +31 -0
  39. package/stories/login/pages/login-passkeys-conditional-authenticate.stories.ts +16 -0
  40. package/stories/login/pages/login-password.stories.ts +52 -0
  41. package/stories/login/pages/login-recovery-authn-code-config.stories.ts +31 -0
  42. package/stories/login/pages/login-recovery-authn-code-input.stories.ts +16 -0
  43. package/stories/login/pages/login-reset-otp.stories.ts +71 -0
  44. package/stories/login/pages/login-reset-password.stories.ts +50 -0
  45. package/stories/login/pages/login-update-password.stories.ts +46 -0
  46. package/stories/login/pages/login-update-profile.stories.ts +31 -0
  47. package/stories/login/pages/login-username.stories.ts +28 -0
  48. package/stories/login/pages/login-verify-email.stories.ts +98 -0
  49. package/stories/login/pages/login-x509-info.stories.ts +40 -0
  50. package/stories/login/pages/login.stories.ts +260 -0
  51. package/stories/login/pages/logout-confirm.stories.ts +44 -0
  52. package/stories/login/pages/register.stories.ts +230 -0
  53. package/stories/login/pages/saml-post-form.stories.ts +17 -0
  54. package/stories/login/pages/select-authenticator.stories.ts +95 -0
  55. package/stories/login/pages/terms.stories.ts +79 -0
  56. package/stories/login/pages/update-email.stories.ts +31 -0
  57. package/stories/login/pages/webauthn-authenticate.stories.ts +126 -0
  58. package/stories/login/pages/webauthn-error.stories.ts +62 -0
  59. package/stories/login/pages/webauthn-register.stories.ts +46 -0
  60. package/src/bin/tools/runFormat.ts +0 -71
  61. package/src/stories/login/pages/login/login.stories.ts +0 -146
@@ -0,0 +1,133 @@
1
+ import { Meta, StoryObj } from '@storybook/angular';
2
+ import { decorators, KcPageStory } from '../KcPageStory';
3
+
4
+ const meta: Meta<KcPageStory> = {
5
+ title: 'account/account.ftl',
6
+ component: KcPageStory,
7
+ decorators: decorators,
8
+ globals: {
9
+ pageId: 'account.ftl'
10
+ }
11
+ };
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<KcPageStory>;
16
+
17
+ export const Default: Story = {};
18
+
19
+ export const UsernameNotEditable: Story = {
20
+ globals: {
21
+ overrides: {
22
+ account: {
23
+ username: 'john_doe',
24
+ email: 'john.doe@gmail.com',
25
+ firstName: 'John',
26
+ lastName: 'Doe'
27
+ },
28
+ realm: {
29
+ registrationEmailAsUsername: false,
30
+ editUsernameAllowed: false
31
+ },
32
+ referrer: {
33
+ url: '/home'
34
+ },
35
+ url: {
36
+ accountUrl: '/account'
37
+ },
38
+ messagesPerField: {
39
+ printIfExists: () => ''
40
+ },
41
+ stateChecker: 'state-checker'
42
+ }
43
+ }
44
+ };
45
+
46
+ export const WithValidationErrors: Story = {
47
+ globals: {
48
+ overrides: {
49
+ account: {
50
+ username: 'john_doe',
51
+ email: '',
52
+ firstName: '',
53
+ lastName: 'Doe'
54
+ },
55
+ realm: {
56
+ registrationEmailAsUsername: false,
57
+ editUsernameAllowed: true
58
+ },
59
+ referrer: {
60
+ url: '/home'
61
+ },
62
+ url: {
63
+ accountUrl: '/account'
64
+ },
65
+ messagesPerField: {
66
+ printIfExists: (field: string) =>
67
+ field === 'email' || field === 'firstName' ? 'has-error' : ''
68
+ },
69
+ stateChecker: 'state-checker'
70
+ }
71
+ }
72
+ };
73
+
74
+ export const EmailAsUsername: Story = {
75
+ globals: {
76
+ overrides: {
77
+ account: {
78
+ email: 'john.doe@gmail.com',
79
+ firstName: 'John',
80
+ lastName: 'Doe'
81
+ },
82
+ realm: {
83
+ registrationEmailAsUsername: true
84
+ },
85
+ referrer: {
86
+ url: '/home'
87
+ },
88
+ url: {
89
+ accountUrl: '/account'
90
+ },
91
+ messagesPerField: {
92
+ printIfExists: () => ''
93
+ },
94
+ stateChecker: 'state-checker'
95
+ }
96
+ }
97
+ };
98
+
99
+ export const WithErrorCode: Story = {
100
+ globals: {
101
+ overrides: {
102
+ code: {
103
+ success: false,
104
+ error: 'Failed to generate code'
105
+ }
106
+ }
107
+ }
108
+ };
109
+
110
+ export const WithFrenchLanguage: Story = {
111
+ globals: {
112
+ overrides: {
113
+ locale: {
114
+ currentLanguageTag: 'fr'
115
+ },
116
+ code: {
117
+ success: true,
118
+ code: 'XYZ789'
119
+ }
120
+ }
121
+ }
122
+ };
123
+
124
+ export const WithHtmlErrorMessage: Story = {
125
+ globals: {
126
+ overrides: {
127
+ code: {
128
+ success: false,
129
+ error: "Something went wrong. <a href='https://example.com'>Try again</a>"
130
+ }
131
+ }
132
+ }
133
+ };
@@ -0,0 +1,196 @@
1
+ import { Meta, StoryObj } from '@storybook/angular';
2
+ import { decorators, KcPageStory } from '../KcPageStory';
3
+
4
+ const meta: Meta<KcPageStory> = {
5
+ title: 'account/applications.ftl',
6
+ component: KcPageStory,
7
+ decorators: decorators,
8
+ globals: {
9
+ pageId: 'applications.ftl'
10
+ }
11
+ };
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<KcPageStory>;
16
+
17
+ export const Default: Story = {
18
+ globals: {
19
+ overrides: {
20
+ applications: {
21
+ applications: [
22
+ {
23
+ realmRolesAvailable: [
24
+ {
25
+ name: 'realmRoleName1',
26
+ description: 'realm role description 1'
27
+ },
28
+ {
29
+ name: 'realmRoleName2',
30
+ description: 'realm role description 2'
31
+ }
32
+ ],
33
+ resourceRolesAvailable: {
34
+ resource1: [
35
+ {
36
+ roleName: 'Resource Role Name 1',
37
+ roleDescription: 'Resource role 1 description',
38
+ clientName: 'Client Name 1',
39
+ clientId: 'client1'
40
+ }
41
+ ],
42
+ resource2: [
43
+ {
44
+ roleName: 'Resource Role Name 2',
45
+ clientName: 'Client Name 1',
46
+ clientId: 'client1'
47
+ }
48
+ ]
49
+ },
50
+ additionalGrants: ['grant1', 'grant2'],
51
+ clientScopesGranted: ['scope1', 'scope2'],
52
+ effectiveUrl: '#',
53
+ client: {
54
+ clientId: 'application1',
55
+ name: 'Application 1',
56
+ consentRequired: true
57
+ }
58
+ },
59
+ {
60
+ realmRolesAvailable: [{ name: 'Realm Role Name 1' }],
61
+ resourceRolesAvailable: {},
62
+ additionalGrants: [],
63
+ clientScopesGranted: [],
64
+ effectiveUrl: '#',
65
+ client: { clientId: 'application2', name: 'Application 2' }
66
+ }
67
+ ]
68
+ }
69
+ }
70
+ }
71
+ };
72
+
73
+ export const NoAvailableRolesOrGrants: Story = {
74
+ globals: {
75
+ overrides: {
76
+ applications: {
77
+ applications: [
78
+ {
79
+ realmRolesAvailable: [],
80
+ resourceRolesAvailable: {},
81
+ additionalGrants: [],
82
+ clientScopesGranted: [],
83
+ effectiveUrl: '#',
84
+ client: {
85
+ clientId: 'application1',
86
+ name: 'Application 1',
87
+ consentRequired: true
88
+ }
89
+ }
90
+ ]
91
+ }
92
+ }
93
+ }
94
+ };
95
+
96
+ export const ConsentNotRequired: Story = {
97
+ globals: {
98
+ overrides: {
99
+ applications: {
100
+ applications: [
101
+ {
102
+ realmRolesAvailable: [],
103
+ resourceRolesAvailable: {},
104
+ additionalGrants: [],
105
+ clientScopesGranted: [],
106
+ effectiveUrl: '#',
107
+ client: {
108
+ clientId: 'application1',
109
+ name: 'Application 1',
110
+ consentRequired: false
111
+ }
112
+ }
113
+ ]
114
+ }
115
+ }
116
+ }
117
+ };
118
+
119
+ export const NoRolesButConsentRequired: Story = {
120
+ globals: {
121
+ overrides: {
122
+ applications: {
123
+ applications: [
124
+ {
125
+ realmRolesAvailable: [],
126
+ resourceRolesAvailable: {},
127
+ additionalGrants: [],
128
+ clientScopesGranted: ['scope1', 'scope2'],
129
+ effectiveUrl: '#',
130
+ client: {
131
+ clientId: 'application1',
132
+ name: 'Application 1',
133
+ consentRequired: true
134
+ }
135
+ }
136
+ ]
137
+ }
138
+ }
139
+ }
140
+ };
141
+
142
+ export const OnlyResourceRolesAvailable: Story = {
143
+ globals: {
144
+ overrides: {
145
+ applications: {
146
+ applications: [
147
+ {
148
+ realmRolesAvailable: [],
149
+ resourceRolesAvailable: {
150
+ resource1: [
151
+ {
152
+ roleName: 'Resource Role Name 1',
153
+ roleDescription: 'Resource role 1 description',
154
+ clientName: 'Client Name 1',
155
+ clientId: 'client1'
156
+ }
157
+ ]
158
+ },
159
+ additionalGrants: [],
160
+ clientScopesGranted: [],
161
+ effectiveUrl: '#',
162
+ client: {
163
+ clientId: 'application1',
164
+ name: 'Application 1',
165
+ consentRequired: true
166
+ }
167
+ }
168
+ ]
169
+ }
170
+ }
171
+ }
172
+ };
173
+
174
+ export const NoAdditionalGrants: Story = {
175
+ globals: {
176
+ overrides: {
177
+ pageId: 'applications.ftl',
178
+ applications: {
179
+ applications: [
180
+ {
181
+ realmRolesAvailable: [{ name: 'Realm Role Name 1' }],
182
+ resourceRolesAvailable: {},
183
+ additionalGrants: [],
184
+ clientScopesGranted: [],
185
+ effectiveUrl: '#',
186
+ client: {
187
+ clientId: 'application1',
188
+ name: 'Application 1',
189
+ consentRequired: true
190
+ }
191
+ }
192
+ ]
193
+ }
194
+ }
195
+ }
196
+ };
@@ -0,0 +1,78 @@
1
+ import { Meta, StoryObj } from '@storybook/angular';
2
+ import { decorators, KcPageStory } from '../KcPageStory';
3
+
4
+ const meta: Meta<KcPageStory> = {
5
+ title: 'account/federatedIdentity.ftl',
6
+ component: KcPageStory,
7
+ decorators: decorators,
8
+ globals: {
9
+ pageId: 'federatedIdentity.ftl'
10
+ }
11
+ };
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<KcPageStory>;
16
+
17
+ export const Default: Story = {};
18
+
19
+ export const NotConnected: Story = {
20
+ globals: {
21
+ overrides: {
22
+ federatedIdentity: {
23
+ identities: [
24
+ {
25
+ providerId: 'google',
26
+ displayName: 'keycloak-oidc',
27
+ connected: false
28
+ }
29
+ ],
30
+ removeLinkPossible: true
31
+ }
32
+ }
33
+ }
34
+ };
35
+
36
+ export const RemoveLinkNotPossible: Story = {
37
+ globals: {
38
+ overrides: {
39
+ federatedIdentity: {
40
+ identities: [
41
+ {
42
+ providerId: 'google',
43
+ displayName: 'Google',
44
+ userName: 'john.doe@gmail.com',
45
+ connected: true
46
+ }
47
+ ],
48
+ removeLinkPossible: false
49
+ },
50
+ stateChecker: '1234',
51
+ url: {
52
+ socialUrl: '/social'
53
+ }
54
+ }
55
+ }
56
+ };
57
+
58
+ export const AddLinkForUnconnectedIdentity: Story = {
59
+ globals: {
60
+ overrides: {
61
+ federatedIdentity: {
62
+ identities: [
63
+ {
64
+ providerId: 'github',
65
+ displayName: 'GitHub',
66
+ userName: '',
67
+ connected: false
68
+ }
69
+ ],
70
+ removeLinkPossible: true
71
+ },
72
+ stateChecker: '1234',
73
+ url: {
74
+ socialUrl: '/social'
75
+ }
76
+ }
77
+ }
78
+ };
@@ -0,0 +1,147 @@
1
+ import { Meta, StoryObj } from '@storybook/angular';
2
+ import { decorators, KcPageStory } from '../KcPageStory';
3
+
4
+ const meta: Meta<KcPageStory> = {
5
+ title: 'account/log.ftl',
6
+ component: KcPageStory,
7
+ decorators: decorators,
8
+ globals: {
9
+ pageId: 'log.ftl'
10
+ }
11
+ };
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<KcPageStory>;
16
+
17
+ export const Default: Story = {
18
+ globals: {
19
+ overrides: {
20
+ log: {
21
+ events: [
22
+ {
23
+ date: '2024-04-26T12:29:08Z',
24
+ ipAddress: '127.0.0.1',
25
+ client: 'keycloakify-frontend',
26
+ details: [
27
+ { key: 'auth_method', value: 'openid-connect' },
28
+ { key: 'username', value: 'john.doe' }
29
+ ],
30
+ event: 'login'
31
+ },
32
+ {
33
+ date: '2024-04-26T12:10:56Z',
34
+ ipAddress: '127.0.0.1',
35
+ client: 'keycloakify-frontend',
36
+ details: [
37
+ { key: 'auth_method', value: 'openid-connect' },
38
+ { key: 'username', value: 'john.doe' }
39
+ ],
40
+ event: 'login'
41
+ }
42
+ // Add more log events as needed
43
+ ]
44
+ }
45
+ }
46
+ }
47
+ };
48
+
49
+ export const LogsMissingDetails: Story = {
50
+ globals: {
51
+ overrides: {
52
+ log: {
53
+ events: [
54
+ {
55
+ date: '2024-04-26T12:29:08Z',
56
+ ipAddress: '127.0.0.1',
57
+ client: '',
58
+ details: [],
59
+ event: 'login'
60
+ }
61
+ ]
62
+ }
63
+ }
64
+ }
65
+ };
66
+
67
+ export const SingleLogEntry: Story = {
68
+ globals: {
69
+ overrides: {
70
+ log: {
71
+ events: [
72
+ {
73
+ date: '2024-04-26T12:29:08Z',
74
+ ipAddress: '127.0.0.1',
75
+ client: 'keycloakify-frontend',
76
+ details: [
77
+ { key: 'auth_method', value: 'openid-connect' },
78
+ { key: 'username', value: 'john.doe' }
79
+ ],
80
+ event: 'login'
81
+ }
82
+ ]
83
+ }
84
+ }
85
+ }
86
+ };
87
+
88
+ export const LogsWithLongDetails: Story = {
89
+ globals: {
90
+ overrides: {
91
+ log: {
92
+ events: [
93
+ {
94
+ date: '2024-04-26T12:29:08Z',
95
+ ipAddress: '127.0.0.1',
96
+ client: 'keycloakify-frontend',
97
+ details: [
98
+ { key: 'auth_method', value: 'openid-connect' },
99
+ { key: 'username', value: 'john.doe' },
100
+ {
101
+ key: 'session_duration',
102
+ value: '2 hours 30 minutes 45 seconds'
103
+ },
104
+ { key: 'location', value: 'Windsor, Ontario, Canada' },
105
+ {
106
+ key: 'user_agent',
107
+ value: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'
108
+ }
109
+ ],
110
+ event: 'login'
111
+ }
112
+ ]
113
+ }
114
+ }
115
+ }
116
+ };
117
+
118
+ export const EmptyClientField: Story = {
119
+ globals: {
120
+ overrides: {
121
+ log: {
122
+ events: [
123
+ {
124
+ date: '2024-04-26T12:29:08Z',
125
+ ipAddress: '127.0.0.1',
126
+ client: '', // Empty client field
127
+ details: [
128
+ { key: 'auth_method', value: 'openid-connect' },
129
+ { key: 'username', value: 'john.doe' }
130
+ ],
131
+ event: 'login'
132
+ }
133
+ ]
134
+ }
135
+ }
136
+ }
137
+ };
138
+
139
+ export const NoLogsAvailable: Story = {
140
+ globals: {
141
+ overrides: {
142
+ log: {
143
+ events: [] // No log events
144
+ }
145
+ }
146
+ }
147
+ };
@@ -0,0 +1,104 @@
1
+ import { Meta, StoryObj } from '@storybook/angular';
2
+ import { decorators, KcPageStory } from '../KcPageStory';
3
+
4
+ const meta: Meta<KcPageStory> = {
5
+ title: 'account/password.ftl',
6
+ component: KcPageStory,
7
+ decorators: decorators,
8
+ globals: {
9
+ pageId: 'password.ftl'
10
+ }
11
+ };
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<KcPageStory>;
16
+
17
+ export const Default: Story = {};
18
+
19
+ export const WithMessage: Story = {
20
+ globals: {
21
+ overrides: {
22
+ kcContext: {
23
+ message: { type: 'success', summary: 'This is a test message' }
24
+ }
25
+ }
26
+ }
27
+ };
28
+
29
+ /**
30
+ * FirstTimePasswordSetup:
31
+ * - Purpose: Tests the page when no password is set (e.g., first login).
32
+ * - Scenario: This renders the form without the current password field.
33
+ * - Key Aspect: Ensures the page only displays fields for setting a new password.
34
+ */
35
+ export const FirstTimePasswordSetup: Story = {
36
+ globals: {
37
+ overrides: {
38
+ kcContext: {
39
+ account: {
40
+ username: 'john_doe'
41
+ },
42
+ password: {
43
+ passwordSet: false
44
+ },
45
+ url: {
46
+ passwordUrl: '/password'
47
+ },
48
+ stateChecker: 'state-checker'
49
+ }
50
+ }
51
+ }
52
+ };
53
+
54
+ /**
55
+ * IncorrectCurrentPassword:
56
+ * - Purpose: Simulates validation error when the current password is incorrect.
57
+ * - Scenario: This renders the page with an error message indicating the current password is incorrect.
58
+ * - Key Aspect: Validates that an error message is correctly displayed for the current password input.
59
+ */
60
+ export const IncorrectCurrentPassword: Story = {
61
+ globals: {
62
+ overrides: {
63
+ kcContext: {
64
+ message: { type: 'error', summary: 'Incorrect current password.' },
65
+ account: {
66
+ username: 'john_doe'
67
+ },
68
+ password: {
69
+ passwordSet: true
70
+ },
71
+ url: {
72
+ passwordUrl: '/password'
73
+ },
74
+ stateChecker: 'state-checker'
75
+ }
76
+ }
77
+ }
78
+ };
79
+
80
+ /**
81
+ * SubmissionSuccessWithRedirect:
82
+ * - Purpose: Simulates a successful form submission with a redirect or success message.
83
+ * - Scenario: After successfully changing the password, a success message and redirect behavior are triggered.
84
+ * - Key Aspect: Verifies the handling of successful submissions.
85
+ */
86
+ export const SubmissionSuccessWithRedirect: Story = {
87
+ globals: {
88
+ overrides: {
89
+ kcContext: {
90
+ message: { type: 'success', summary: 'Password successfully changed.' },
91
+ account: {
92
+ username: 'john_doe'
93
+ },
94
+ password: {
95
+ passwordSet: true
96
+ },
97
+ url: {
98
+ passwordUrl: '/password'
99
+ },
100
+ stateChecker: 'state-checker'
101
+ }
102
+ }
103
+ }
104
+ };