Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
asapo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
Joao Alvim Oliveira Dias De Almeida
asapo
Commits
cb5c87b7
Commit
cb5c87b7
authored
4 years ago
by
Sergey Yakubov
Browse files
Options
Downloads
Patches
Plain Diff
auth error on missing access types
parent
efac66e3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
authorizer/src/asapo_authorizer/server/authorize.go
+4
-0
4 additions, 0 deletions
authorizer/src/asapo_authorizer/server/authorize.go
authorizer/src/asapo_authorizer/server/authorize_test.go
+4
-0
4 additions, 0 deletions
authorizer/src/asapo_authorizer/server/authorize_test.go
with
8 additions
and
0 deletions
authorizer/src/asapo_authorizer/server/authorize.go
+
4
−
0
View file @
cb5c87b7
...
...
@@ -161,6 +161,10 @@ func checkToken(token string, subject_expect string) (accessTypes []string, err
return
nil
,
err
}
if
extra_claim
.
AccessTypes
==
nil
||
len
(
extra_claim
.
AccessTypes
)
==
0
{
return
nil
,
errors
.
New
(
"missing access types"
)
}
if
subject
!=
subject_expect
{
return
nil
,
errors
.
New
(
"wrong token for "
+
subject_expect
)
}
...
...
This diff is collapsed.
Click to expand it.
authorizer/src/asapo_authorizer/server/authorize_test.go
+
4
−
0
View file @
cb5c87b7
...
...
@@ -180,6 +180,10 @@ var authTests = [] struct {
message
string
answer
string
}{
{
"processed"
,
"test"
,
"auto"
,
"dataSource"
,
prepareUserToken
(
"bt_test"
,
nil
),
"127.0.0.2"
,
http
.
StatusUnauthorized
,
"missing access types"
,
""
},
{
"processed"
,
"test"
,
"auto"
,
"dataSource"
,
prepareUserToken
(
"bt_test"
,[]
string
{}),
"127.0.0.2"
,
http
.
StatusUnauthorized
,
"empty access types"
,
""
},
{
"processed"
,
"test"
,
"auto"
,
"dataSource"
,
prepareUserToken
(
"bt_test"
,[]
string
{
"write"
}),
"127.0.0.2"
,
http
.
StatusOK
,
"user source with correct token"
,
`{"beamtimeId":"test","beamline":"bl1","dataSource":"dataSource","core-path":"./tf/gpfs/bl1/2019/data/test","beamline-path":"","source-type":"processed","access-types":["write"]}`
},
{
"processed"
,
"test_online"
,
"auto"
,
"dataSource"
,
prepareUserToken
(
"bt_test_online"
,[]
string
{
"read"
}),
"127.0.0.1"
,
http
.
StatusOK
,
"with online path, processed type"
,
...
...
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