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
b5580c36
Commit
b5580c36
authored
Jun 29, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass fewer arguments to KerberosHelper
parent
5b7be6e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
app/controllers/projects/git_http_controller.rb
app/controllers/projects/git_http_controller.rb
+8
-5
app/helpers/kerberos_spnego_helper.rb
app/helpers/kerberos_spnego_helper.rb
+4
-1
No files found.
app/controllers/projects/git_http_controller.rb
View file @
b5580c36
...
...
@@ -47,7 +47,7 @@ class Projects::GitHttpController < Projects::ApplicationController
return
# Allow access
end
if
allow_basic_auth?
&&
has_basic_credentials?
(
request
)
if
allow_basic_auth?
&&
basic_auth_provided?
login
,
password
=
user_name_and_password
(
request
)
auth_result
=
Gitlab
::
Auth
.
find_for_git_client
(
login
,
password
,
project:
project
,
ip:
request
.
ip
)
...
...
@@ -62,10 +62,9 @@ class Projects::GitHttpController < Projects::ApplicationController
if
ci?
||
user
return
# Allow access
end
elsif
allow_kerberos_spnego_auth?
&&
has_spnego_credentials?
(
request
)
spnego_token
=
Base64
.
strict_decode64
(
auth_param
(
request
))
@user
=
find_kerberos_user
(
spnego_token
)
elsif
allow_kerberos_spnego_auth?
&&
spnego_provided?
@user
=
find_kerberos_user
if
user
send_final_spnego_response
return
# Allow access
...
...
@@ -77,6 +76,10 @@ class Projects::GitHttpController < Projects::ApplicationController
render
plain:
"HTTP Basic: Access denied
\n
"
,
status:
401
end
def
basic_auth_provided?
has_basic_credentials?
(
request
)
end
def
send_challenges
challenges
=
[]
challenges
<<
'Basic realm="GitLab"'
if
allow_basic_auth?
...
...
app/helpers/kerberos_spnego_helper.rb
View file @
b5580c36
module
KerberosSpnegoHelper
include
ActionController
::
HttpAuthentication
::
Basic
attr_reader
:spnego_response_token
def
allow_basic_auth?
...
...
@@ -31,7 +33,7 @@ module KerberosSpnegoHelper
end
end
def
has_spnego_credentials?
(
request
)
def
spnego_provided?
request
.
authorization
.
present?
&&
(
auth_scheme
(
request
)
==
'Negotiate'
)
end
...
...
@@ -40,6 +42,7 @@ module KerberosSpnegoHelper
end
def
find_kerberos_user
(
spnego_token
)
spnego_token
=
Base64
.
strict_decode64
(
auth_param
(
request
))
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