From bcd6ceb27178aa76463f9e780def1cffd2a4c421 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sat, 4 Aug 2018 17:27:55 -0400 Subject: [PATCH] feat: authentication improvements --- client/components/admin.vue | 26 +- client/components/admin/admin-auth.vue | 50 +- client/components/admin/admin-general.vue | 8 +- client/components/common/nav-header.vue | 8 +- .../admin/auth/auth-query-strategies.gql | 4 +- client/store/admin.js | 4 +- client/store/index.js | 6 +- client/store/site.js | 15 + package.json | 117 +- server/core/auth.js | 33 +- server/core/kernel.js | 1 + server/db/migrations/2.0.0.js | 3 - server/graph/resolvers/authentication.js | 23 +- server/graph/resolvers/storage.js | 2 +- server/graph/schemas/authentication.graphql | 3 + server/helpers/common.js | 20 + server/master.js | 13 - server/models/authentication.js | 40 +- server/models/storage.js | 22 +- .../authentication/auth0/definition.yml | 3 + .../authentication/azure/definition.yml | 3 + .../modules/authentication/cas/definition.yml | 3 + .../authentication/discord/definition.yml | 3 + .../authentication/dropbox/definition.yml | 3 + .../authentication/facebook/definition.yml | 3 + .../authentication/github/definition.yml | 3 + .../authentication/google/definition.yml | 3 + .../authentication/ldap/definition.yml | 18 +- .../authentication/local/definition.yml | 3 + .../authentication/microsoft/definition.yml | 5 +- .../authentication/oauth2/definition.yml | 5 +- .../authentication/oidc/authentication.js | 35 + .../authentication/oidc/definition.yml | 16 + .../authentication/okta/authentication.js | 29 + .../authentication/okta/definition.yml | 21 + .../authentication/slack/definition.yml | 3 + .../authentication/twitch/definition.yml | 3 + server/views/main/welcome.pug | 2 +- yarn.lock | 3005 ++++++++--------- 39 files changed, 1733 insertions(+), 1834 deletions(-) create mode 100644 client/store/site.js create mode 100644 server/modules/authentication/oidc/authentication.js create mode 100644 server/modules/authentication/oidc/definition.yml create mode 100644 server/modules/authentication/okta/authentication.js create mode 100644 server/modules/authentication/okta/definition.yml diff --git a/client/components/admin.vue b/client/components/admin.vue index e8676e80..cc4dea76 100644 --- a/client/components/admin.vue +++ b/client/components/admin.vue @@ -76,7 +76,9 @@ router-view v-footer.py-2.justify-center(app, absolute, :color='darkMode ? "" : "grey lighten-3"', inset, height='auto') - .caption.grey--text.text--darken-1 {{ $t('common:footer.poweredBy') }} Wiki.js + .caption.grey--text.text--darken-1 + span(v-if='company && company.length > 0') {{ $t('common:footer.copyright', { company: company, year: currentYear }) }} |  + span {{ $t('common:footer.poweredBy') }} Wiki.js v-snackbar( :color='notification.style' @@ -92,11 +94,11 @@ diff --git a/client/components/admin/admin-auth.vue b/client/components/admin/admin-auth.vue index 04a33961..2a895ab2 100644 --- a/client/components/admin/admin-auth.vue +++ b/client/components/admin/admin-auth.vue @@ -25,31 +25,49 @@ v-tab-item(v-for='(strategy, n) in activeStrategies', :key='strategy.key', :transition='false', :reverse-transition='false') v-card.pa-3(flat, tile) v-form + .authlogo + img(:src='strategy.logo', :alt='strategy.title') + v-subheader.pl-0 {{strategy.title}} + .caption {{strategy.description}} + .caption: a(:href='strategy.website') {{strategy.website}} + v-divider.mt-3 v-subheader.pl-0 Strategy Configuration .body-1.ml-3(v-if='!strategy.config || strategy.config.length < 1') This strategy has no configuration options you can modify. template(v-else, v-for='cfg in strategy.config') v-select( v-if='cfg.value.type === "string" && cfg.value.enum' + outline + background-color='grey lighten-2' :items='cfg.value.enum' :key='cfg.key' - :label='cfg.key | startCase' + :label='cfg.value.title' v-model='cfg.value.value' prepend-icon='settings_applications' + :hint='cfg.value.hint ? cfg.value.hint : ""' + persistent-hint + :class='cfg.value.hint ? "mb-2" : ""' ) v-switch( v-else-if='cfg.value.type === "boolean"' :key='cfg.key' - :label='cfg.key | startCase' + :label='cfg.value.title' v-model='cfg.value.value' color='primary' prepend-icon='settings_applications' + :hint='cfg.value.hint ? cfg.value.hint : ""' + persistent-hint ) v-text-field( v-else + outline + background-color='grey lighten-2' :key='cfg.key' - :label='cfg.key | startCase' + :label='cfg.value.title' v-model='cfg.value.value' prepend-icon='settings_applications' + :hint='cfg.value.hint ? cfg.value.hint : ""' + persistent-hint + :class='cfg.value.hint ? "mb-2" : ""' ) v-divider.mt-3 v-subheader.pl-0 Registration @@ -61,18 +79,21 @@ hint='Allow any user successfully authorized by the strategy to access the wiki.' persistent-hint ) - v-select.ml-3( + v-combobox.ml-3.mt-3( label='Limit to specific email domains' v-model='strategy.domainWhitelist' prepend-icon='mail_outline' + outline + background-color='grey lighten-2' persistent-hint deletable-chips clearable multiple chips - tags ) - v-select.ml-3( + v-autocomplete.ml-3( + outline + background-color='grey lighten-2' :items='groups' item-text='name' item-value='id' @@ -82,7 +103,6 @@ hint='Automatically assign new users to these groups.' persistent-hint deletable-chips - autocomplete clearable multiple chips @@ -173,6 +193,20 @@ export default { } - diff --git a/client/components/admin/admin-general.vue b/client/components/admin/admin-general.vue index f6392c26..07bbd7d0 100644 --- a/client/components/admin/admin-general.vue +++ b/client/components/admin/admin-general.vue @@ -36,6 +36,7 @@ .px-3.pb-3 v-text-field( label='Company / Organization Name' + v-model='company' :counter='255' prepend-icon='public' persistent-hint @@ -89,15 +90,20 @@ diff --git a/client/components/common/nav-header.vue b/client/components/common/nav-header.vue index 485abf30..bb589651 100644 --- a/client/components/common/nav-header.vue +++ b/client/components/common/nav-header.vue @@ -83,9 +83,7 @@