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
628c72ea
Unverified
Commit
628c72ea
authored
Jul 17, 2022
by
Mirco T
Committed by
GitHub
Jul 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: CAS authentication module (#5452)
Co-authored-by:
SeaLife
<
mtries@united-internet.de
>
parent
dffffd3a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
5 deletions
+46
-5
authentication.js
server/modules/authentication/cas/authentication.js
+13
-3
definition.yml
server/modules/authentication/cas/definition.yml
+33
-2
No files found.
server/modules/authentication/cas/authentication.js
View file @
628c72ea
const
_
=
require
(
'lodash'
)
/* global WIKI */
// ------------------------------------
...
...
@@ -10,15 +11,24 @@ module.exports = {
init
(
passport
,
conf
)
{
passport
.
use
(
conf
.
key
,
new
CASStrategy
({
ssoBaseURL
:
conf
.
ssoBaseURL
,
serverBaseURL
:
conf
.
serverBaseURL
,
version
:
conf
.
casVersion
,
ssoBaseURL
:
conf
.
casUrl
,
serverBaseURL
:
conf
.
baseUrl
,
serviceURL
:
conf
.
callbackURL
,
passReqToCallback
:
true
},
async
(
req
,
profile
,
cb
)
=>
{
try
{
const
user
=
await
WIKI
.
models
.
users
.
processProfile
({
providerKey
:
req
.
params
.
strategy
,
profile
profile
:
{
...
profile
,
id
:
_
.
get
(
profile
.
attributes
,
conf
.
uniqueIdAttribute
,
profile
.
user
),
email
:
_
.
get
(
profile
.
attributes
,
conf
.
emailAttribute
),
name
:
_
.
get
(
profile
.
attributes
,
conf
.
displayNameAttribute
,
profile
.
user
),
picture
:
''
}
})
cb
(
null
,
user
)
}
catch
(
err
)
{
cb
(
err
,
null
)
...
...
server/modules/authentication/cas/definition.yml
View file @
628c72ea
...
...
@@ -6,6 +6,37 @@ logo: https://static.requarks.io/logo/cas.svg
color
:
green darken-2
website
:
https://apereo.github.io/cas/
useForm
:
false
isAvailable
:
true
props
:
ssoBaseURL
:
String
serverBaseURL
:
String
baseUrl
:
type
:
String
title
:
Base URL
hint
:
'
Base-URL
of
your
WikiJS
(for
example:
https://wiki.example.com)'
order
:
1
casUrl
:
type
:
String
title
:
URL to the CAS Server
hint
:
'
Base-URL
of
the
CAS
server,
including
context
path.
(for
example:
https://login.company.com/cas)'
order
:
2
casVersion
:
type
:
String
title
:
CAS Version
hint
:
'
The
version
of
CAS
to
use'
order
:
3
enum
:
-
CAS3.0
-
CAS1.0
default
:
'
CAS3.0'
emailAttribute
:
type
:
String
title
:
Attribute key which contains the users email
default
:
email
order
:
4
displayNameAttribute
:
type
:
String
title
:
Attribute key which contains the users display name (leave empty if there is none)
order
:
5
uniqueIdAttribute
:
type
:
String
title
:
Attribute key which contains the unique identifier of a user. (if empty, username will be used)
order
:
6
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