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
2bec0e82
Commit
2bec0e82
authored
Mar 09, 2020
by
Imre Farkas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix smartcard param check in User::BuildService
parent
c567376b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletion
+39
-1
changelogs/unreleased/33641-fix_smartcard_param_check_in_user_build.yml
...eleased/33641-fix_smartcard_param_check_in_user_build.yml
+5
-0
ee/app/services/ee/users/build_service.rb
ee/app/services/ee/users/build_service.rb
+1
-1
ee/spec/services/ee/users/build_service_spec.rb
ee/spec/services/ee/users/build_service_spec.rb
+33
-0
No files found.
changelogs/unreleased/33641-fix_smartcard_param_check_in_user_build.yml
0 → 100644
View file @
2bec0e82
---
title
:
Fix user registration when smartcard authentication is enabled
merge_request
:
26800
author
:
type
:
fixed
ee/app/services/ee/users/build_service.rb
View file @
2bec0e82
...
@@ -70,7 +70,7 @@ module EE
...
@@ -70,7 +70,7 @@ module EE
def
build_smartcard_identity
(
user
,
params
)
def
build_smartcard_identity
(
user
,
params
)
smartcard_identity_attrs
=
params
.
slice
(
:certificate_subject
,
:certificate_issuer
)
smartcard_identity_attrs
=
params
.
slice
(
:certificate_subject
,
:certificate_issuer
)
if
smartcard_identity_attrs
.
an
y?
unless
smartcard_identity_attrs
.
empt
y?
user
.
smartcard_identities
.
build
(
subject:
params
[
:certificate_subject
],
user
.
smartcard_identities
.
build
(
subject:
params
[
:certificate_subject
],
issuer:
params
[
:certificate_issuer
])
issuer:
params
[
:certificate_issuer
])
end
end
...
...
ee/spec/services/ee/users/build_service_spec.rb
View file @
2bec0e82
...
@@ -28,6 +28,39 @@ describe Users::BuildService do
...
@@ -28,6 +28,39 @@ describe Users::BuildService do
end
end
end
end
end
end
context
'smartcard authentication enabled'
do
before
do
allow
(
Gitlab
::
Auth
::
Smartcard
).
to
receive
(
:enabled?
).
and_return
(
true
)
end
context
'smartcard params'
do
let
(
:subject
)
{
'/O=Random Corp Ltd/CN=gitlab-user/emailAddress=gitlab-user@random-corp.org'
}
let
(
:issuer
)
{
'/O=Random Corp Ltd/CN=Random Corp'
}
let
(
:smartcard_identity_params
)
do
{
certificate_subject:
subject
,
certificate_issuer:
issuer
}
end
before
do
params
.
merge!
(
smartcard_identity_params
)
end
it
'sets smartcard identity attributes'
do
expect
(
SmartcardIdentity
).
to
(
receive
(
:new
)
.
with
(
hash_including
(
issuer:
issuer
,
subject:
subject
))
.
and_call_original
)
service
.
execute
end
end
context
'missing smartcard params'
do
it
'works as expected'
do
expect
{
service
.
execute
}.
not_to
raise_error
end
end
end
end
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