Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
97cf5d73
Commit
97cf5d73
authored
Mar 20, 2018
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Omniauth callbacks moved to methods
parent
da2191af
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
26 deletions
+38
-26
lib/gitlab/omniauth_initializer.rb
lib/gitlab/omniauth_initializer.rb
+38
-26
No files found.
lib/gitlab/omniauth_initializer.rb
View file @
97cf5d73
...
...
@@ -27,32 +27,7 @@ module Gitlab
# An Array from the configuration will be expanded.
provider_arguments
.
concat
provider
[
'args'
]
when
Hash
# Add procs for handling SLO
if
provider
[
'name'
]
==
'cas3'
provider
[
'args'
][
:on_single_sign_out
]
=
lambda
do
|
request
|
ticket
=
request
.
params
[
:session_index
]
raise
"Service Ticket not found."
unless
Gitlab
::
Auth
::
OAuth
::
Session
.
valid?
(
:cas3
,
ticket
)
Gitlab
::
Auth
::
OAuth
::
Session
.
destroy
(
:cas3
,
ticket
)
true
end
end
if
provider
[
'name'
]
==
'authentiq'
provider
[
'args'
][
:remote_sign_out_handler
]
=
lambda
do
|
request
|
authentiq_session
=
request
.
params
[
'sid'
]
if
Gitlab
::
Auth
::
OAuth
::
Session
.
valid?
(
:authentiq
,
authentiq_session
)
Gitlab
::
Auth
::
OAuth
::
Session
.
destroy
(
:authentiq
,
authentiq_session
)
true
else
false
end
end
end
if
provider
[
'name'
]
==
'shibboleth'
provider
[
'args'
][
:fail_with_empty_uid
]
=
true
end
set_provider_specific_defaults
(
provider
)
# A Hash from the configuration will be passed as is.
provider_arguments
<<
provider
[
'args'
].
symbolize_keys
...
...
@@ -61,5 +36,42 @@ module Gitlab
config
.
omniauth
provider
[
'name'
].
to_sym
,
*
provider_arguments
end
end
def
set_provider_specific_defaults
(
provider
)
# Add procs for handling SLO
if
provider
[
'name'
]
==
'cas3'
provider
[
'args'
][
:on_single_sign_out
]
=
cas3_signout_handler
end
if
provider
[
'name'
]
==
'authentiq'
provider
[
'args'
][
:remote_sign_out_handler
]
=
authentiq_signout_handler
end
if
provider
[
'name'
]
==
'shibboleth'
provider
[
'args'
][
:fail_with_empty_uid
]
=
true
end
end
def
cas3_signout_handler
lambda
do
|
request
|
ticket
=
request
.
params
[
:session_index
]
raise
"Service Ticket not found."
unless
Gitlab
::
Auth
::
OAuth
::
Session
.
valid?
(
:cas3
,
ticket
)
Gitlab
::
Auth
::
OAuth
::
Session
.
destroy
(
:cas3
,
ticket
)
true
end
end
def
authentiq_signout_handler
lambda
do
|
request
|
authentiq_session
=
request
.
params
[
'sid'
]
if
Gitlab
::
Auth
::
OAuth
::
Session
.
valid?
(
:authentiq
,
authentiq_session
)
Gitlab
::
Auth
::
OAuth
::
Session
.
destroy
(
:authentiq
,
authentiq_session
)
true
else
false
end
end
end
end
end
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