@things-factory/auth-ui 8.0.0-beta.1 → 8.0.0-beta.4

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 (59) hide show
  1. package/package.json +4 -4
  2. package/client/auth-style-sign.ts +0 -194
  3. package/client/bootstrap.ts +0 -51
  4. package/client/components/abstract-auth-page.ts +0 -301
  5. package/client/components/abstract-password-reset.ts +0 -163
  6. package/client/components/abstract-sign.ts +0 -127
  7. package/client/components/change-password.ts +0 -153
  8. package/client/components/contact-us.ts +0 -116
  9. package/client/components/create-domain-popup.ts +0 -141
  10. package/client/components/create-role.ts +0 -123
  11. package/client/components/create-user.ts +0 -117
  12. package/client/components/credential-manager.ts +0 -64
  13. package/client/components/delete-user-popup.ts +0 -117
  14. package/client/components/domain-switch.ts +0 -127
  15. package/client/components/invite-customer.ts +0 -104
  16. package/client/components/invite-user.ts +0 -104
  17. package/client/components/my-login-history.ts +0 -101
  18. package/client/components/ownership-transfer-popup.ts +0 -110
  19. package/client/components/partner-info-card.ts +0 -89
  20. package/client/components/partner-role-editor.ts +0 -153
  21. package/client/components/profile-component.ts +0 -392
  22. package/client/components/role-edit-form.ts +0 -92
  23. package/client/components/role-privilege-editor.ts +0 -268
  24. package/client/components/role-selector.ts +0 -102
  25. package/client/components/user-role-editor.ts +0 -499
  26. package/client/constants/application.ts +0 -9
  27. package/client/constants/index.ts +0 -1
  28. package/client/entries/auth/activate.ts +0 -272
  29. package/client/entries/auth/checkin.ts +0 -190
  30. package/client/entries/auth/forgot-password.ts +0 -112
  31. package/client/entries/auth/reset-password.ts +0 -22
  32. package/client/entries/auth/result.ts +0 -193
  33. package/client/entries/auth/signin.ts +0 -18
  34. package/client/entries/auth/signup.ts +0 -115
  35. package/client/entries/auth/unlock-user.ts +0 -22
  36. package/client/entries/oauth2/oauth2-decision-error-page.ts +0 -50
  37. package/client/entries/oauth2/oauth2-decision-page.ts +0 -196
  38. package/client/entries/public/home.ts +0 -246
  39. package/client/index.ts +0 -124
  40. package/client/pages/app-binding/app-binding.ts +0 -423
  41. package/client/pages/app-binding/app-bindings.ts +0 -171
  42. package/client/pages/appliance/appliance.ts +0 -452
  43. package/client/pages/appliance/home.ts +0 -177
  44. package/client/pages/appliance/register.ts +0 -183
  45. package/client/pages/application/application.ts +0 -428
  46. package/client/pages/application/applications.ts +0 -182
  47. package/client/pages/application/register.ts +0 -211
  48. package/client/pages/attribute/attribute-set-item-list.ts +0 -237
  49. package/client/pages/attribute/attribute-set-management.ts +0 -282
  50. package/client/pages/auth-provider/auth-provider-management.ts +0 -381
  51. package/client/pages/domain/domain-management.ts +0 -410
  52. package/client/pages/partner/partner-management.ts +0 -112
  53. package/client/pages/profile.ts +0 -32
  54. package/client/pages/role/role-management.ts +0 -134
  55. package/client/pages/user/user-management.ts +0 -223
  56. package/client/route.ts +0 -67
  57. package/client/themes/auth-theme.css +0 -65
  58. package/client/utils/password-rule.ts +0 -37
  59. package/server/index.ts +0 -0
@@ -1,193 +0,0 @@
1
- import '@material/web/button/elevated-button.js'
2
-
3
- import '@operato/lottie-player'
4
- import '../../components/profile-component'
5
-
6
- import { css, html, LitElement } from 'lit'
7
- import { customElement, property } from 'lit/decorators.js'
8
-
9
- import { i18next, localize } from '@operato/i18n'
10
- import { isSafari } from '@operato/utils'
11
-
12
- @customElement('auth-result')
13
- export class AuthResult extends localize(i18next)(LitElement) {
14
- static styles = [
15
- css`
16
- :host {
17
- display: flex;
18
- width: 100vw;
19
- height: 100vh;
20
- height: 100dvh;
21
- background-color: var(--md-sys-color-primary);
22
- color: var(--md-sys-color-on-primary);
23
- }
24
- .wrap {
25
- display: block;
26
- width: 450px;
27
- min-width: 350px;
28
- margin: 0 auto;
29
- text-align: center;
30
- }
31
- .auth-brand {
32
- color: #fff;
33
- }
34
- .auth-brand img {
35
- margin: 15% auto 5px auto;
36
- width: 100px;
37
- border: 3px solid var(--md-sys-color-on-primary);
38
- border-radius: 25px;
39
- box-shadow: var(--box-shadow);
40
- }
41
- .name {
42
- display: block;
43
- font: var(--auth-brand-name);
44
- text-shadow: var(--auth-brand-name-shadow);
45
- }
46
- h1 {
47
- margin: 50px 0 0 0;
48
- padding: 0;
49
- font-size: 24px;
50
- color: var(--auth-title-color, var(--md-sys-color-on-primary));
51
- }
52
- p {
53
- margin: 0;
54
- padding: var(--auth-description-padding);
55
- font: var(--auth-description-font);
56
- color: var(--auth-description-color, var(--md-sys-color-on-secondary));
57
- }
58
- :host *:focus {
59
- outline: none;
60
- }
61
- .user {
62
- background: url(/assets/images/icon-profile.png) center top no-repeat;
63
- margin: var(--profile-icon-margin);
64
- padding: 180px 20px 20px 20px;
65
- color: var(--md-sys-color-secondary);
66
- font: var(--header-bar-title);
67
- text-align: center;
68
- }
69
-
70
- label {
71
- font: bold 14px var(--theme-font);
72
- color: var(--md-sys-color-primary);
73
- }
74
-
75
- #button-area {
76
- border-top: 1px dashed rgba(0, 0, 0, 0.1);
77
- padding-top: 10px;
78
- }
79
-
80
- md-elevated-button {
81
- --md-button-horizontal-padding: var(--spacing-medium);
82
- --md-button-ink-color: var(--md-sys-color-primary);
83
- }
84
-
85
- .lottie-container {
86
- width: 100%;
87
- height: 300px;
88
- position: absolute;
89
- left: 0;
90
- bottom: 0;
91
- pointer-events: none;
92
- }
93
- .lottie-container lottie-player {
94
- position: absolute;
95
- bottom: -6%;
96
- width: 100%;
97
- height: auto;
98
- }
99
-
100
- @media (max-width: 450px) {
101
- .wrap {
102
- width: 85%;
103
- min-width: 320px;
104
- padding-bottom: 100px;
105
- }
106
- .auth-form {
107
- grid-template-columns: 1fr;
108
- }
109
- .auth-brand img {
110
- margin: 12% auto 5px auto;
111
- width: 75px;
112
- }
113
- .lottie-container {
114
- overflow: hidden;
115
- height: 200px;
116
- pointer-events: none;
117
- }
118
- .lottie-container lottie-player {
119
- width: 1200px;
120
- left: -30%;
121
- }
122
- }
123
- `
124
- ]
125
-
126
- @property({ type: Object }) data: any
127
- @property({ type: String }) message?: string
128
- @property({ type: String }) resultType?: string
129
-
130
- private _applicationMeta?: { icon?: string; title?: string; description?: string }
131
-
132
- updated(changed) {
133
- if (changed.has('data')) {
134
- this.message = this.data.message
135
- this.resultType = this.data.resultType || 'congratulations'
136
- }
137
- }
138
-
139
- render() {
140
- var { icon, title, description } = this.applicationMeta
141
-
142
- return html`
143
- <div class="wrap ${this.resultType}">
144
- <div class="auth-brand">
145
- <img src=${icon} />
146
- <strong class="name">${title}</strong>
147
- <span class="welcome-msg">${description}</span>
148
- </div>
149
-
150
- <div id="message-area">
151
- <h1>${this.message || ''}</h1>
152
-
153
- <!--description message container-->
154
- <p></p>
155
- </div>
156
- <div id="button-area">
157
- <md-elevated-button
158
- @click=${e => {
159
- window.location.replace('/auth/signin')
160
- }}
161
- >
162
- <md-icon slot="icon">home</md-icon>
163
- ${i18next.t('button.go to home')}
164
- </md-elevated-button>
165
- </div>
166
-
167
- ${isSafari()
168
- ? html``
169
- : html`
170
- <div class="lottie-container">
171
- <lottie-player autoplay loop src="../../assets/images/background-animation.json"></lottie-player>
172
- </div>
173
- `}
174
- </div>
175
- `
176
- }
177
-
178
- get applicationMeta() {
179
- if (!this._applicationMeta) {
180
- var iconLink: HTMLLinkElement | null = document.querySelector('link[rel="application-icon"]')
181
- var titleMeta: HTMLMetaElement | null = document.querySelector('meta[name="application-name"]')
182
- var descriptionMeta: HTMLMetaElement | null = document.querySelector('meta[name="application-description"]')
183
-
184
- this._applicationMeta = {
185
- icon: iconLink?.href,
186
- title: titleMeta ? titleMeta.content : 'Things Factory',
187
- description: descriptionMeta ? descriptionMeta.content : 'Reimagining Software'
188
- }
189
- }
190
-
191
- return this._applicationMeta
192
- }
193
- }
@@ -1,18 +0,0 @@
1
- import { customElement } from 'lit/decorators.js'
2
-
3
- import { AbstractSign } from '../../components/abstract-sign'
4
-
5
- @customElement('auth-signin')
6
- export class AuthSignin extends AbstractSign {
7
- get pageName() {
8
- return 'sign in'
9
- }
10
-
11
- get actionUrl() {
12
- return '/auth/signin'
13
- }
14
-
15
- get autocompletable() {
16
- return true
17
- }
18
- }
@@ -1,115 +0,0 @@
1
- import '@operato/i18n/ox-i18n.js'
2
-
3
- import { html } from 'lit'
4
- import { customElement, query } from 'lit/decorators.js'
5
-
6
- import { i18next } from '@operato/i18n'
7
-
8
- import { AbstractSign } from '../../components/abstract-sign'
9
- import { generatePasswordPatternHelp, generatePasswordPatternRegExp } from '../../utils/password-rule'
10
-
11
- @customElement('auth-signup')
12
- export class AuthSignup extends AbstractSign {
13
- private passwordPattern?: string
14
- private passwordHelp?: string
15
-
16
- get pageName() {
17
- return 'sign up'
18
- }
19
-
20
- get actionUrl() {
21
- return '/auth/signup'
22
- }
23
-
24
- @query('#confirm-password') confirmPass!: HTMLInputElement
25
-
26
- get formfields() {
27
- const { username = '', name = '', email = '' } = this.data || {}
28
-
29
- // .validationMessage=${this.passwordHelp || ''}
30
- // .validationMessage=${String(i18next.t('text.passwords do not match'))}
31
-
32
- return html`
33
- <div class="field">
34
- <md-filled-text-field
35
- name="username"
36
- type="text"
37
- label=${String(i18next.t('field.username'))}
38
- .value=${username}
39
- required
40
- ><md-icon slot="leading-icon">badge</md-icon></md-filled-text-field
41
- >
42
- </div>
43
- <div class="field">
44
- <md-filled-text-field name="name" type="text" label=${String(i18next.t('field.name'))} .value=${name} required
45
- ><md-icon slot="leading-icon">id_card</md-icon></md-filled-text-field
46
- >
47
- </div>
48
- <div class="field">
49
- <md-filled-text-field
50
- name="email"
51
- type="email"
52
- label=${String(i18next.t('field.email'))}
53
- required
54
- .value=${email}
55
- autocapitalize="off"
56
- autocomplete="off"
57
- @input=${(e: Event) => {
58
- const target = e.target as HTMLInputElement
59
- if (target.validity.typeMismatch) {
60
- target.setCustomValidity(i18next.t('text.invalid-email'))
61
- } else {
62
- target.setCustomValidity('')
63
- }
64
- }}
65
- ><md-icon slot="leading-icon">mail</md-icon></md-filled-text-field
66
- >
67
- </div>
68
- <div class="field">
69
- <md-filled-text-field
70
- name="password"
71
- type="password"
72
- label=${String(i18next.t('field.password'))}
73
- pattern=${this.passwordPattern || ''}
74
- supporting-text=${this.passwordHelp || ''}
75
- required
76
- autocomplete="off"
77
- @input=${e => {
78
- var val = e.target.value
79
- this.confirmPass.setAttribute('pattern', val.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '[$&]'))
80
- }}
81
- >
82
- ><md-icon slot="leading-icon">password</md-icon></md-filled-text-field
83
- >
84
- </div>
85
- <div class="field">
86
- <md-filled-text-field
87
- id="confirm-password"
88
- name="confirm-password"
89
- type="password"
90
- autocomplete="off"
91
- label=${String(i18next.t('field.confirm password'))}
92
- required
93
- >
94
- ><md-icon slot="leading-icon">password</md-icon></md-filled-text-field
95
- >
96
- </div>
97
- <md-elevated-button class="ui button" @click=${e => this._onSubmit(e)}>
98
- <ox-i18n msgid="field.${this.pageName}"></ox-i18n>
99
- </md-elevated-button>
100
- `
101
- }
102
-
103
- languageUpdated() {
104
- this.passwordPattern = generatePasswordPatternRegExp(this.data.passwordRule).source
105
- this.passwordHelp = generatePasswordPatternHelp(this.data.passwordRule)
106
- }
107
-
108
- get links() {
109
- return html`
110
- <a class="link" href="/auth/signin">
111
- <md-text-button><ox-i18n msgid="field.sign in"></ox-i18n></md-text-button>
112
- </a>
113
- `
114
- }
115
- }
@@ -1,22 +0,0 @@
1
- import { customElement } from 'lit/decorators.js'
2
-
3
- import { AbstractPasswordReset } from '../../components/abstract-password-reset'
4
-
5
- @customElement('unlock-user')
6
- export class UnlockUser extends AbstractPasswordReset {
7
- get pageName() {
8
- return 'unlock user'
9
- }
10
-
11
- get actionUrl() {
12
- return '/auth/unlock-user'
13
- }
14
-
15
- get submitButtonLabel() {
16
- return 'label.unlock account'
17
- }
18
-
19
- get title() {
20
- return 'unlock account'
21
- }
22
- }
@@ -1,50 +0,0 @@
1
- import '@material/web/button/elevated-button.js'
2
-
3
- import { html, LitElement } from 'lit'
4
- import { customElement, property } from 'lit/decorators.js'
5
-
6
- @customElement('oauth2-decision-error')
7
- class OAuth2DecisionErrorPage extends LitElement {
8
- @property({ type: Object }) data: any = {}
9
- @property({ type: Object }) user: any = {}
10
- @property({ type: Object }) domain: any = {}
11
- @property({ type: Object }) req: any = {}
12
- @property({ type: String }) redirectURI: string = ''
13
- @property({ type: String }) transactionID: string = ''
14
-
15
- render() {
16
- return html`
17
- <h2>Application Binding Error</h2>
18
-
19
- <p>Hi ${this.user.name}!</p>
20
- <p><b>Application Not Found</b></p>
21
- <p>You better check you give a correct client id (appKey)</p>
22
-
23
- <p>Company: ${this.domain.subdomain}</p>
24
- <p>Application Client ID : ${this.req.clientID}</p>
25
- <p>Redirect URI : ${this.redirectURI}</p>
26
- <p>State : ${this.req.state}</p>
27
-
28
- <form>
29
- <input name="transaction_id" value="${this.transactionID}" hidden />
30
- <input name="subdomain" type="text" value="${this.domain.subdomain}" hidden />
31
- <input name="appKey" value="${this.req.clientID}" hidden />
32
- <input name="scope" value="${this.req.scope}" hidden />
33
- <input name="state" type="text" value="${this.req.state}" hidden />
34
- <input name="email" type="text" value="${this.user.email}" hidden />
35
-
36
- <md-elevated-button raised @click="${() => history.back()}">Move back</md-elevated-button>
37
- </form>
38
- `
39
- }
40
-
41
- updated(changedProps) {
42
- if (changedProps.has('data')) {
43
- this.user = this.data?.oauth2?.user || this.user
44
- this.domain = this.data?.domain || this.domain
45
- this.req = this.data?.oauth2?.req || this.req
46
- this.redirectURI = this.data?.oauth2?.redirectURI || this.redirectURI
47
- this.transactionID = this.data?.oauth2?.transactionID || this.transactionID
48
- }
49
- }
50
- }
@@ -1,196 +0,0 @@
1
- import '@material/web/button/elevated-button.js'
2
- import '../../components/role-selector'
3
-
4
- import gql from 'graphql-tag'
5
- import { css, html, LitElement } from 'lit'
6
- import { customElement, property, query } from 'lit/decorators.js'
7
-
8
- import { client } from '@operato/graphql'
9
- import { i18next } from '@operato/i18n'
10
- import { OxPrompt } from '@operato/popup/ox-prompt.js'
11
- import { ButtonContainerStyles } from '@operato/styles'
12
-
13
- @customElement('oauth2-decision')
14
- class OAuth2DecisionPage extends LitElement {
15
- static styles = [
16
- ButtonContainerStyles,
17
- css`
18
- :host {
19
- display: flex;
20
- flex-direction: column;
21
-
22
- border: 1px solid var(--md-sys-color-primary);
23
- margin: var(--spacing-medium);
24
- padding: var(--spacing-medium);
25
- font: normal 15px var(--theme-font);
26
- color: var(--md-sys-color-secondary);
27
- }
28
-
29
- [field-2column] {
30
- border-radius: var(--border-radius);
31
- display: grid;
32
- grid-template-columns: 1fr 1fr;
33
- gap: 5px 15px;
34
- clear: both;
35
- max-width: var(--input-container-max-width);
36
- }
37
-
38
- [field] {
39
- display: flex;
40
- flex-direction: column;
41
- padding-bottom: var(--spacing-medium);
42
- }
43
-
44
- input {
45
- border: var(--border-dim-color);
46
- border-radius: var(--border-radius);
47
- margin: var(--input-margin);
48
- padding: var(--input-padding);
49
- min-width: 250px;
50
- font: var(--input-font);
51
- }
52
-
53
- label {
54
- display: flex;
55
- flex-direction: column;
56
- font: var(--label-font);
57
- color: var(--label-color, var(--md-sys-color-on-surface));
58
- text-transform: var(--label-text-transform);
59
- }
60
-
61
- md-elevated-button {
62
- margin-right: var(--spacing-small);
63
- }
64
- `
65
- ]
66
-
67
- @property({ type: Object }) data: any = {}
68
- @property({ type: Object }) user: any = {}
69
- @property({ type: Object }) client: any = {}
70
- @property({ type: Object }) domain: any = {}
71
- @property({ type: Object }) req: any = {}
72
- @property({ type: String }) redirectURI: string = ''
73
- @property({ type: String }) transactionID: string = ''
74
- @property({ type: Array }) roles: any[] = []
75
-
76
- @query('role-selector') roleSelector!: HTMLElement & { selectedRoles: () => any[] }
77
-
78
- render() {
79
- return html`
80
- <h2>Application Binding</h2>
81
- <p>Hi ${this.user.name}!</p>
82
- <p><b> ${this.client.name} </b> is requesting access to your account.</p>
83
- <p>Do you approve?</p>
84
-
85
- <form field-2column>
86
- <div field>
87
- <label
88
- >${i18next.t('label.company')}
89
- <input readonly value="${this.domain.subdomain}" />
90
- </label>
91
-
92
- <label
93
- >${i18next.t('label.client-id')}
94
- <input readonly value="${this.req.clientID}" />
95
- </label>
96
- </div>
97
-
98
- <div field>
99
- <label
100
- >${i18next.t('label.redirect_uri')}
101
- <input readonly value="${this.redirectURI}" />
102
- </label>
103
-
104
- <label
105
- >${i18next.t('label.state')}
106
- <input readonly value="${this.req.state}" />
107
- </label>
108
- </div>
109
- </form>
110
-
111
- <role-selector .roleCategory="${this.domain.name}" .roles="${this.roles}"></role-selector>
112
-
113
- <div class="button-container">
114
- <md-elevated-button @click="${() => this.decision(true)}" raised label="Allow"></md-elevated-button>
115
- <md-elevated-button @click="${() => this.decision(false)}" raised danger label="Deny"></md-elevated-button>
116
- </div>
117
- `
118
- }
119
-
120
- async firstUpdated() {
121
- this.fetchMyRoles()
122
- }
123
-
124
- updated(changedProps) {
125
- if (changedProps.has('data')) {
126
- this.user = this.data?.oauth2?.user || this.user
127
- this.client = this.data?.oauth2?.client || this.client
128
- this.domain = this.data?.domain || this.domain
129
- this.req = this.data?.oauth2?.req || this.req
130
- this.redirectURI = this.data?.oauth2?.redirectURI || this.redirectURI
131
- this.transactionID = this.data?.oauth2?.transactionID || this.transactionID
132
- }
133
- }
134
-
135
- async fetchMyRoles() {
136
- const response = await client.query({
137
- query: gql`
138
- query myRoles {
139
- myRoles {
140
- id
141
- name
142
- description
143
- }
144
- }
145
- `
146
- })
147
-
148
- if (!response.errors?.length) {
149
- this.roles = response.data.myRoles
150
- }
151
- }
152
-
153
- async decision(allowOrCancel) {
154
- const selectedRoles = this.selectedRoles()
155
- if (allowOrCancel && !selectedRoles?.length) {
156
- await OxPrompt.open({
157
- title: i18next.t('title.nothing selected'),
158
- text: i18next.t('text.should select at least one of x', { x: i18next.t('label.role') }),
159
- confirmButton: { text: i18next.t('button.confirm') }
160
- })
161
-
162
- return
163
- }
164
-
165
- let data: any = {
166
- transaction_id: this.transactionID,
167
- subdomain: this.domain.subdomain,
168
- appKey: this.req.clientID,
169
- state: this.req.state,
170
- email: this.user.email,
171
- scopes: selectedRoles
172
- }
173
- if (!allowOrCancel) {
174
- data.cancel = 'Deny'
175
- }
176
-
177
- const response = await fetch('/oauth/decision', {
178
- method: 'POST',
179
- mode: 'cors',
180
- credentials: 'include',
181
- headers: {
182
- 'Content-Type': 'application/json'
183
- },
184
- redirect: 'follow',
185
- body: JSON.stringify(data)
186
- })
187
-
188
- if (response.redirected) {
189
- location.href = response.url
190
- }
191
- }
192
-
193
- selectedRoles() {
194
- return this.roleSelector.selectedRoles()
195
- }
196
- }