Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tank
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
tank
Commits
b0ad2920
Commit
b0ad2920
authored
5 years ago
by
Christian Pointner
Browse files
Options
Downloads
Patches
Plain Diff
allow setting authorization info for passwd backend
parent
ea29eadf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
auth/backend_passwd.go
+5
-5
5 additions, 5 deletions
auth/backend_passwd.go
auth/config.go
+4
-2
4 additions, 2 deletions
auth/config.go
contrib/sample-cfg.yaml
+24
-15
24 additions, 15 deletions
contrib/sample-cfg.yaml
with
33 additions
and
22 deletions
auth/backend_passwd.go
+
5
−
5
View file @
b0ad2920
...
...
@@ -60,7 +60,8 @@ func (b *PasswdBackend) NewSession(ctx context.Context, arguments json.RawMessag
return
nil
,
errors
.
New
(
"mandatory arguments missing"
)
}
if
b
.
userDB
[
args
.
Username
]
.
Password
!=
args
.
Password
{
user
,
exists
:=
b
.
userDB
[
args
.
Username
]
if
!
exists
||
user
.
Password
!=
args
.
Password
{
return
nil
,
errors
.
New
(
"invalid username and or password"
)
}
...
...
@@ -69,10 +70,9 @@ func (b *PasswdBackend) NewSession(ctx context.Context, arguments json.RawMessag
}
// TODO: setting this directly is probably fine but rather ugly...
s
.
Username
=
args
.
Username
// TODO: handle authorization
s
.
ReadOnly
=
true
s
.
AllShows
=
true
s
.
ReadOnly
=
user
.
ReadOnly
s
.
AllShows
=
user
.
AllShows
s
.
Shows
=
user
.
Shows
s
.
setState
(
SessionStateLoggedIn
)
return
...
...
This diff is collapsed.
Click to expand it.
auth/config.go
+
4
−
2
View file @
b0ad2920
...
...
@@ -42,8 +42,10 @@ type OIDCConfig struct {
}
type
PasswdUserConfig
struct
{
Password
string
`json:"password" yaml:"password" toml:"password"`
// TODO: add authorization info
Password
string
`json:"password" yaml:"password" toml:"password"`
ReadOnly
bool
`json:"readonly" yaml:"readonly" toml:"readonly"`
AllShows
bool
`json:"all-shows" yaml:"all-shows" toml:"all-shows"`
Shows
[]
string
`json:"shows" yaml:"shows" toml:"shows"`
}
type
Config
struct
{
...
...
This diff is collapsed.
Click to expand it.
contrib/sample-cfg.yaml
+
24
−
15
View file @
b0ad2920
...
...
@@ -29,21 +29,30 @@ importer:
normalizer
:
ffmpeg
### uncomment to enable authentication
auth
:
sessions
:
## defaults to 24h
max-age
:
12h
oidc
:
issuer-url
:
http://localhost:8000/openid
client-id
:
${OIDC_CLIENT_ID}
client-secret
:
${OIDC_CLIENT_SECRET}
callback-url
:
http://localhost:8040/auth/oidc/callback
login-timeout
:
10m
# defaults to 5 Minutes
passwd
:
hugo
:
password
:
secret
someuser
:
password
:
changeme
# auth:
# sessions:
# ## defaults to 24h
# max-age: 12h
# oidc:
# issuer-url: http://localhost:8000/openid
# client-id: ${OIDC_CLIENT_ID}
# client-secret: ${OIDC_CLIENT_SECRET}
# callback-url: http://localhost:8040/auth/oidc/callback
# login-timeout: 10m # defaults to 5 Minutes
# passwd:
# admin:
# password: very-secret
# all-shows: true
# engine:
# password: rather-secret
# readonly: true
# all-shows: true
# hugo:
# password: changeme
# readonly: true
# shows:
# - hugo
# - yet-another-hugo-show
### uncomment to enable CORS headers
### see: https://godoc.org/github.com/rs/cors#Options
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment