Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
8b712227
Commit
8b712227
authored
Jul 14, 2019
by
Nick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: github enterprise auth compatibility
parent
d74683b5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
6 deletions
+33
-6
authentication.js
server/modules/authentication/github/authentication.js
+15
-6
definition.yml
server/modules/authentication/github/definition.yml
+18
-0
No files found.
server/modules/authentication/github/authentication.js
View file @
8b712227
...
...
@@ -9,13 +9,22 @@ const _ = require('lodash')
module
.
exports
=
{
init
(
passport
,
conf
)
{
let
githubConfig
=
{
clientID
:
conf
.
clientId
,
clientSecret
:
conf
.
clientSecret
,
callbackURL
:
conf
.
callbackURL
,
scope
:
[
'user:email'
]
}
if
(
conf
.
useEnterprise
)
{
githubConfig
.
authorizationURL
=
`https://
${
conf
.
enterpriseDomain
}
/login/oauth/authorize`
githubConfig
.
tokenURL
=
`https://
${
conf
.
enterpriseDomain
}
/login/oauth/access_token`
githubConfig
.
userProfileURL
=
conf
.
enterpriseUserEndpoint
githubConfig
.
userEmailURL
=
`
${
conf
.
enterpriseUserEndpoint
}
/emails`
}
passport
.
use
(
'github'
,
new
GitHubStrategy
({
clientID
:
conf
.
clientId
,
clientSecret
:
conf
.
clientSecret
,
callbackURL
:
conf
.
callbackURL
,
scope
:
[
'user:email'
]
},
async
(
accessToken
,
refreshToken
,
profile
,
cb
)
=>
{
new
GitHubStrategy
(
githubConfig
,
async
(
accessToken
,
refreshToken
,
profile
,
cb
)
=>
{
try
{
const
user
=
await
WIKI
.
models
.
users
.
processProfile
({
profile
:
{
...
...
server/modules/authentication/github/definition.yml
View file @
8b712227
...
...
@@ -18,4 +18,22 @@ props:
title
:
Client Secret
hint
:
Application Client Secret
order
:
2
useEnterprise
:
type
:
Boolean
title
:
Use GitHub Enterprise
hint
:
Enable if you're using the self-hosted GitHub Enterprise version
default
:
false
order
:
3
enterpriseDomain
:
type
:
String
title
:
GitHub Enterprise Domain
hint
:
GitHub Enterprise Only - Domain of your installation (e.g. github.company.com). Leave blank otherwise.
default
:
'
'
order
:
4
enterpriseUserEndpoint
:
type
:
String
title
:
GitHub Enterprise User Endpoint
hint
:
GitHub Enterprise Only - Endpoint to fetch user details (e.g. https://api.github.com/user). Leave blank otherwise.
default
:
'
https://api.github.com/user'
order
:
5
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment