mirror of
https://github.com/documize/community.git
synced 2025-07-24 15:49:44 +02:00
auth settings ne wUI
This commit is contained in:
parent
75aa00beca
commit
79531e01b3
2 changed files with 101 additions and 84 deletions
|
@ -10,16 +10,14 @@
|
|||
// https://documize.com
|
||||
|
||||
import { equal, empty } from '@ember/object/computed';
|
||||
|
||||
import { set } from '@ember/object';
|
||||
import { copy } from '@ember/object/internals';
|
||||
import { inject as service } from '@ember/service';
|
||||
import Component from '@ember/component';
|
||||
import constants from '../../utils/constants';
|
||||
import encoding from '../../utils/encoding';
|
||||
import NotifierMixin from "../../mixins/notifier";
|
||||
|
||||
export default Component.extend(NotifierMixin, {
|
||||
export default Component.extend({
|
||||
appMeta: service(),
|
||||
isDocumizeProvider: equal('authProvider', constants.AuthProvider.Documize),
|
||||
isKeycloakProvider: equal('authProvider', constants.AuthProvider.Keycloak),
|
||||
|
@ -29,7 +27,7 @@ export default Component.extend(NotifierMixin, {
|
|||
KeycloakPublicKeyError: empty('keycloakConfig.publicKey'),
|
||||
KeycloakAdminUserError: empty('keycloakConfig.adminUser'),
|
||||
KeycloakAdminPasswordError: empty('keycloakConfig.adminPassword'),
|
||||
keycloakConfig: {
|
||||
keycloakConfig: {
|
||||
url: '',
|
||||
realm: '',
|
||||
clientId: '',
|
||||
|
@ -128,7 +126,7 @@ export default Component.extend(NotifierMixin, {
|
|||
set(config, 'publicKey', encoding.Base64.encode(this.get('keycloakConfig.publicKey')));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
let data = { authProvider: provider, authConfig: JSON.stringify(config) };
|
||||
|
||||
this.get('onSave')(data).then(() => {
|
||||
|
@ -138,18 +136,15 @@ export default Component.extend(NotifierMixin, {
|
|||
this.showNotification(response.message);
|
||||
data.authProvider = constants.AuthProvider.Documize;
|
||||
this.get('onSave')(data).then(() => {
|
||||
this.showNotification('Reverted back to Documize');
|
||||
});
|
||||
} else {
|
||||
if (data.authProvider === this.get('appMeta.authProvider')) {
|
||||
this.showNotification(response.message);
|
||||
// this.showNotification(response.message);
|
||||
} else {
|
||||
this.get('onChange')(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.showNotification('Saved');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,76 +1,98 @@
|
|||
<div class="page-customize">
|
||||
<div class="auth-admin">
|
||||
<form>
|
||||
<div class="form-header">
|
||||
<div class="title">Authentication</div>
|
||||
<div class="tip">Determine the method for user authentication</div>
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Provider</label>
|
||||
<div class="tip">External authentication servers, services must be accessible from the server running this Documize instance</div>
|
||||
{{#ui/ui-radio selected=isDocumizeProvider onClick=(action 'onDocumize')}}Documize — email/password{{/ui/ui-radio}}
|
||||
{{#ui/ui-radio selected=isKeycloakProvider onClick=(action 'onKeycloak')}}Keycloak — bring your own authentication server{{/ui/ui-radio}}
|
||||
</div>
|
||||
|
||||
{{#if isKeycloakProvider}}
|
||||
<div class="form-header">
|
||||
<div class="title">Keycloak Configuration</div>
|
||||
<div class="tip">Connection parameters — create a documize user in Master realm with 'manage-users' role against target realm</div>
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Keycloak Server URL</label>
|
||||
<div class="tip">e.g. http://localhost:8888/auth</div>
|
||||
{{focus-input id="keycloak-url" type="text" value=keycloakConfig.url class=(if KeycloakUrlError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Keycloak Realm</label>
|
||||
<div class="tip">e.g. main</div>
|
||||
{{input id="keycloak-realm" type="text" value=keycloakConfig.realm class=(if keycloakRealmError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Keycloak Realm Public Key</label>
|
||||
<div class="tip">Copy the RSA Public Key from Realm Settings → Keys</div>
|
||||
{{textarea id="keycloak-publicKey" type="text" value=keycloakConfig.publicKey rows=7 class=(if KeycloakPublicKeyError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Keycloak OIDC Client ID</label>
|
||||
<div class="tip">e.g. account</div>
|
||||
{{input id="keycloak-clientId" type="text" value=keycloakConfig.clientId class=(if KeycloakClientIdError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Keycloak Group ID (Optional)</label>
|
||||
<div class="tip">If you want to sync users in a particular Group (e.g. 'Documize Users'), provide the Group ID (e.g. 511d8b61-1ec8-45f6-bc8d-5de64d54c9d2)</div>
|
||||
{{input id="keycloak-group" type="text" value=keycloakConfig.group}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Keycloak Username</label>
|
||||
<div class="tip">Used to connect with Keycloak and sync users with Documize (create user under Master Realm and assign 'view-users' role against Realm specified above)</div>
|
||||
{{input id="keycloak-admin-user" type="text" value=keycloakConfig.adminUser class=(if KeycloakAdminUserError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Keycloak Password</label>
|
||||
<div class="tip">Used to connect with Keycloak and sync users with Documize</div>
|
||||
{{input id="keycloak-admin-password" type="password" value=keycloakConfig.adminPassword class=(if KeycloakAdminPasswordError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Disable Logout</label>
|
||||
<div class="tip">Hide the logout button for Keycloak users</div>
|
||||
<div class="checkbox">
|
||||
{{input type="checkbox" checked=keycloakConfig.disableLogout}}
|
||||
<label for="allowAnonymousAccess">Do not show logout button</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Grant Add Space Permission</label>
|
||||
<div class="tip">Determine if Keycloak sync'ed users permission to add new spaces</div>
|
||||
<div class="checkbox">
|
||||
{{input type="checkbox" checked=keycloakConfig.defaultPermissionAddSpace}}
|
||||
<label for="allowAnonymousAccess">Can add spaces</label>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="regular-button button-blue" {{action 'onSave'}}>save</div>
|
||||
</form>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="view-customize">
|
||||
<h1 class="admin-heading">Authentication</h1>
|
||||
<h2 class="sub-heading">Choose user authentication mechanism</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="view-customize">
|
||||
|
||||
<form class="mt-5">
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">Provider</label>
|
||||
<div class="col-sm-10">
|
||||
{{#ui/ui-radio selected=isDocumizeProvider onClick=(action 'onDocumize')}} Documize — email/password{{/ui/ui-radio}}
|
||||
{{#ui/ui-radio selected=isKeycloakProvider onClick=(action 'onKeycloak')}} Keycloak — bring your own authentication server{{/ui/ui-radio}}
|
||||
<small class="form-text text-muted">
|
||||
External authentication servers, services must be accessible from the server running this Documize instance
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#if isKeycloakProvider}}
|
||||
<div class="form-group row">
|
||||
<label for="keycloak-url" class="col-sm-2 col-form-label">Keycloak Server URL</label>
|
||||
<div class="col-sm-10">
|
||||
{{focus-input id="keycloak-url" type="text" value=keycloakConfig.url class=(if KeycloakUrlError 'form-control is-invalid' 'form-control')}}
|
||||
<small class="form-text text-muted">e.g. http://localhost:8888/auth</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="keycloak-realm" class="col-sm-2 col-form-label">Keycloak Realm</label>
|
||||
<div class="col-sm-10">
|
||||
{{input id="keycloak-realm" type="text" value=keycloakConfig.realm class=(if keycloakRealmError 'form-control is-invalid' 'form-control')}}
|
||||
<small class="form-text text-muted">e.g. main</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="keycloak-publicKey" class="col-sm-2 col-form-label">Keycloak Realm Public Key</label>
|
||||
<div class="col-sm-10">
|
||||
{{textarea id="keycloak-publicKey" type="text" value=keycloakConfig.publicKey rows=7 class=(if KeycloakPublicKeyError 'form-control is-invalid' 'form-control')}}
|
||||
<small class="form-text text-muted">Copy the RSA Public Key from Realm Settings → Keys</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="keycloak-clientId" class="col-sm-2 col-form-label">Keycloak OIDC Client ID</label>
|
||||
<div class="col-sm-10">
|
||||
{{input id="keycloak-clientId" type="text" value=keycloakConfig.clientId class=(if KeycloakClientIdError 'form-control is-invalid' 'form-control')}}
|
||||
<small class="form-text text-muted">e.g. account</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="keycloak-group" class="col-sm-2 col-form-label">Keycloak Group ID (Optional)</label>
|
||||
<div class="col-sm-10">
|
||||
{{input id="keycloak-group" type="text" value=keycloakConfig.group class="form-control"}}
|
||||
<small class="form-text text-muted">If you want to sync users in a particular Group (e.g. 'Documize Users'), provide the Group ID (e.g. 511d8b61-1ec8-45f6-bc8d-5de64d54c9d2)</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="keycloak-admin-user" class="col-sm-2 col-form-label">Keycloak Username</label>
|
||||
<div class="col-sm-10">
|
||||
{{input id="keycloak-admin-user" type="text" value=keycloakConfig.adminUser class=(if KeycloakAdminUserError 'form-control is-invalid' 'form-control')}}
|
||||
<small class="form-text text-muted">Used to connect with Keycloak and sync users with Documize (create user under Master Realm and assign 'view-users' role against Realm specified above)</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="keycloak-admin-password" class="col-sm-2 col-form-label">Keycloak Password</label>
|
||||
<div class="col-sm-10">
|
||||
{{input id="keycloak-admin-password" type="password" value=keycloakConfig.adminPassword class=(if KeycloakAdminPasswordError 'form-control is-invalid' 'form-control')}}
|
||||
<small class="form-text text-muted">Used to connect with Keycloak and sync users with Documize</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="keycloak-admin-password" class="col-sm-2 col-form-label">Logout</label>
|
||||
<div class="col-sm-10">
|
||||
<label class="form-check-label">
|
||||
{{input type="checkbox" class="form-check-input" checked=keycloakConfig.disableLogout}}
|
||||
Hide the logout button for Keycloak users
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="keycloak-admin-password" class="col-sm-2 col-form-label">Space Permission</label>
|
||||
<div class="col-sm-10">
|
||||
<label class="form-check-label">
|
||||
{{input type="checkbox" class="form-check-input" checked=keycloakConfig.defaultPermissionAddSpace}}
|
||||
Can add spaces
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="btn btn-success mt-4" {{action 'onSave'}}>Save</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue