Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
id
auth
Commits
0c751fc0
Commit
0c751fc0
authored
Feb 09, 2018
by
ale
Browse files
Implement static group assignments by backend
parent
5121efbf
Changes
2
Show whitespace changes
Inline
Side-by-side
README.md
View file @
0c751fc0
...
...
@@ -90,6 +90,8 @@ Each service definition is a dictionary with the following attributes:
*
`file`
is simply a path to a user list file, see the
*
File
backend
*
section below
*
`ldap`
configues the LDAP backend for this service
*
`static_groups`
is a list of group names that users sourced from
this backend will automatically be added to
*
`challenge_response`
is a boolean parameter that, when true, enables
two-factor authentication for this service (it should be enabled
only for interactive services)
...
...
server/authserver.go
View file @
0c751fc0
...
...
@@ -162,6 +162,7 @@ type requestFilter interface {
type
BackendSpec
struct
{
LDAPSpec
*
LDAPServiceConfig
`yaml:"ldap"`
FileSpec
string
`yaml:"file"`
StaticGroups
[]
string
`yaml:"static_groups"`
}
// ServiceConfig defines the authentication backends for a service.
...
...
@@ -385,6 +386,9 @@ func (s *Server) getUser(ctx context.Context, serviceConfig *ServiceConfig, user
for
_
,
spec
:=
range
serviceConfig
.
BackendSpecs
{
for
_
,
b
:=
range
s
.
backends
{
if
user
,
ok
:=
b
.
GetUser
(
ctx
,
spec
,
username
);
ok
{
if
len
(
spec
.
StaticGroups
)
>
0
{
user
.
Groups
=
append
(
user
.
Groups
,
spec
.
StaticGroups
...
)
}
return
user
,
true
}
}
...
...
Write
Preview
Supports
Markdown
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