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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
6b0b7393
Commit
6b0b7393
authored
Jun 29, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Beat Rubocop's PerceivedComplexity
parent
6c02dc40
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
app/controllers/projects/git_http_controller.rb
app/controllers/projects/git_http_controller.rb
+7
-8
app/helpers/kerberos_spnego_helper.rb
app/helpers/kerberos_spnego_helper.rb
+4
-0
No files found.
app/controllers/projects/git_http_controller.rb
View file @
6b0b7393
...
...
@@ -67,22 +67,21 @@ class Projects::GitHttpController < Projects::ApplicationController
@user
=
find_kerberos_user
(
spnego_token
)
if
user
se
t_www_authenticate
(
spnego_challenge
)
if
spnego_response_token
se
nd_final_spnego_response
return
# Allow access
end
end
# Authentication failed. Challenge the client to provide credentials.
challenges
=
[]
challenges
<<
'Basic realm="GitLab"'
if
allow_basic_auth?
challenges
<<
spnego_challenge
if
allow_kerberos_spnego_auth?
set_www_authenticate
(
challenges
.
join
(
"
\n
"
))
send_challenges
render
plain:
"HTTP Basic: Access denied
\n
"
,
status:
401
end
def
set_www_authenticate
(
value
)
headers
[
'Www-Authenticate'
]
=
value
def
send_challenges
challenges
=
[]
challenges
<<
'Basic realm="GitLab"'
if
allow_basic_auth?
challenges
<<
spnego_challenge
if
allow_kerberos_spnego_auth?
headers
[
'Www-Authenticate'
]
=
challenges
.
join
(
"
\n
"
)
if
challenges
.
any?
end
def
ensure_project_found!
...
...
app/helpers/kerberos_spnego_helper.rb
View file @
6b0b7393
...
...
@@ -35,6 +35,10 @@ module KerberosSpnegoHelper
request
.
authorization
.
present?
&&
(
auth_scheme
(
request
)
==
'Negotiate'
)
end
def
send_final_spnego_response
headers
[
'Www-Authenticate'
]
=
spnego_challenge
if
spnego_response_token
end
def
find_kerberos_user
(
spnego_token
)
krb_principal
=
spnego_credentials!
(
spnego_token
)
return
unless
krb_principal
...
...
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