Commit 9966a97b authored by Nick's avatar Nick

feat: azure ad auth (wip)

parent 08fd1060
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
.subheading Wiki.js {{info.currentVersion}} .subheading Wiki.js {{info.currentVersion}}
.body-2(v-if='isLatestVersion') {{$t('admin:dashboard.versionLatest')}} .body-2(v-if='isLatestVersion') {{$t('admin:dashboard.versionLatest')}}
.body-2(v-else) {{$t('admin:dashboard.versionNew', { version: info.latestVersion })}} .body-2(v-else) {{$t('admin:dashboard.versionNew', { version: info.latestVersion })}}
v-flex(xs12) v-flex(xs12, xl6)
v-card.radius-7 v-card.radius-7
v-card-title.subheading(:class='$vuetify.dark ? `grey darken-2` : `grey lighten-5`') Recent Pages v-card-title.subheading(:class='$vuetify.dark ? `grey darken-2` : `grey lighten-5`') Recent Pages
v-data-table.pb-2( v-data-table.pb-2(
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
td.grey--text.text--darken-2(width='250') td.grey--text.text--darken-2(width='250')
.caption: strong Updated {{ props.item.updatedAt | moment('from') }} .caption: strong Updated {{ props.item.updatedAt | moment('from') }}
.caption Created {{ props.item.createdAt | moment('calendar') }} .caption Created {{ props.item.createdAt | moment('calendar') }}
v-flex(xs12) v-flex(xs12, xl6)
v-card.radius-7 v-card.radius-7
v-card-title.subheading(:class='$vuetify.dark ? `grey darken-2` : `grey lighten-5`') Most Popular Pages v-card-title.subheading(:class='$vuetify.dark ? `grey darken-2` : `grey lighten-5`') Most Popular Pages
v-data-table.pb-2( v-data-table.pb-2(
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
v-spacer v-spacer
v-btn.animated.fadeInDown.wait-p2s(outline, color='grey', large, @click='refresh') v-btn.animated.fadeInDown.wait-p2s(outline, color='grey', large, @click='refresh')
v-icon refresh v-icon refresh
v-btn.animated.fadeInDown(color='primary', large, depressed, @click='createUser', disabled) v-btn.animated.fadeInDown(color='primary', large, depressed, @click='createUser')
v-icon(left) add v-icon(left) add
span New User span New User
v-card.wiki-form.mt-3.animated.fadeInUp v-card.wiki-form.mt-3.animated.fadeInUp
......
# ==================== # ====================
# --- Build Assets --- # --- Build Assets ---
# ==================== # ====================
FROM node:10.15-alpine AS assets FROM node:10.16-alpine AS assets
RUN apk add yarn g++ make python --no-cache RUN apk add yarn g++ make python --no-cache
...@@ -23,7 +23,7 @@ RUN yarn --production --frozen-lockfile --non-interactive ...@@ -23,7 +23,7 @@ RUN yarn --production --frozen-lockfile --non-interactive
# =============== # ===============
# --- Release --- # --- Release ---
# =============== # ===============
FROM node:10.15-alpine FROM node:10.16-alpine
LABEL maintainer="requarks.io" LABEL maintainer="requarks.io"
RUN apk add bash curl git openssh gnupg sqlite --no-cache && \ RUN apk add bash curl git openssh gnupg sqlite --no-cache && \
......
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
"objection": "1.6.9", "objection": "1.6.9",
"passport": "0.4.0", "passport": "0.4.0",
"passport-auth0": "1.1.0", "passport-auth0": "1.1.0",
"passport-azure-ad-oauth2": "0.0.4", "passport-azure-ad": "4.1.0",
"passport-cas": "0.1.1", "passport-cas": "0.1.1",
"passport-discord": "0.1.3", "passport-discord": "0.1.3",
"passport-dropbox-oauth2": "1.1.0", "passport-dropbox-oauth2": "1.1.0",
......
...@@ -4,23 +4,21 @@ ...@@ -4,23 +4,21 @@
// Azure AD Account // Azure AD Account
// ------------------------------------ // ------------------------------------
const AzureAdOAuth2Strategy = require('passport-azure-ad-oauth2').Strategy const OIDCStrategy = require('passport-azure-ad').OIDCStrategy
module.exports = { module.exports = {
init (passport, conf) { init (passport, conf) {
const jwt = require('jsonwebtoken') passport.use('azure',
passport.use('azure_ad_oauth2', new OIDCStrategy({
new AzureAdOAuth2Strategy({ identityMetadata: conf.entryPoint,
clientID: conf.clientId, clientID: conf.clientId,
clientSecret: conf.clientSecret, redirectUrl: conf.callbackURL,
callbackURL: conf.callbackURL, responseType: 'id_token',
resource: conf.resource, responseMode: 'form_post',
tenant: conf.tenant scope: ['profile', 'email', 'openid'],
}, (accessToken, refreshToken, params, profile, cb) => { allowHttpForRedirectUrl: WIKI.IS_DEBUG
console.info(params, profile) }, (iss, sub, profile, cb) => {
let waadProfile = jwt.decode(params.id_token) console.info(iss, sub, profile)
waadProfile.id = waadProfile.oid
waadProfile.provider = 'azure'
// WIKI.models.users.processProfile(waadProfile).then((user) => { // WIKI.models.users.processProfile(waadProfile).then((user) => {
// return cb(null, user) || true // return cb(null, user) || true
// }).catch((err) => { // }).catch((err) => {
......
...@@ -5,14 +5,21 @@ author: requarks.io ...@@ -5,14 +5,21 @@ author: requarks.io
logo: https://static.requarks.io/logo/azure.svg logo: https://static.requarks.io/logo/azure.svg
color: blue darken-3 color: blue darken-3
website: https://azure.microsoft.com/services/active-directory/ website: https://azure.microsoft.com/services/active-directory/
isAvailable: false isAvailable: true
useForm: false useForm: false
scopes:
- profile
- email
- openid
props: props:
clientId: String entryPoint:
clientSecret: String type: String
resource: title: Identity Metadata Endpoint
type: String, hint: The metadata endpoint provided by the Microsoft Identity Portal that provides the keys and other important information at runtime.
default: '00000002-0000-0000-c000-000000000000' order: 1
tenant: clientId:
type: String, type: String
default: YOUR_TENANT.onmicrosoft.com title: Client ID
hint: The client ID of your application in AAD (Azure Active Directory)
order: 2
This diff was suppressed by a .gitattributes entry.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment