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
35c218ac
Commit
35c218ac
authored
5 years ago
by
Christian Pointner
Browse files
Options
Downloads
Patches
Plain Diff
added arguments for new oidc session request to in future accept access_tokens
parent
95513371
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/auth.go
+1
-1
1 addition, 1 deletion
auth/auth.go
auth/oidc.go
+13
-1
13 additions, 1 deletion
auth/oidc.go
auth/utils.go
+2
-1
2 additions, 1 deletion
auth/utils.go
with
16 additions
and
3 deletions
auth/auth.go
+
1
−
1
View file @
35c218ac
...
...
@@ -97,7 +97,7 @@ func newSession() http.Handler {
sendHTTPErrorResponse
(
w
,
http
.
StatusConflict
,
"OIDC authentication is not enabled"
)
return
}
s
,
err
:=
auth
.
oidc
.
NewOIDCSession
()
s
,
err
:=
auth
.
oidc
.
NewOIDCSession
(
request
.
Arguments
)
if
err
!=
nil
{
sendHTTPErrorResponse
(
w
,
http
.
StatusBadRequest
,
"Error creating session: "
+
err
.
Error
())
return
...
...
This diff is collapsed.
Click to expand it.
auth/oidc.go
+
13
−
1
View file @
35c218ac
...
...
@@ -26,6 +26,7 @@ package auth
import
(
"context"
"encoding/json"
"errors"
"net/http"
"time"
...
...
@@ -105,11 +106,17 @@ func (b *OIDCBackend) String() string {
// TODO: implement session refresh go-routine
// see: https://github.com/golang/oauth2/issues/84
func
(
b
*
OIDCBackend
)
NewOIDCSession
()
(
s
*
Session
,
err
error
)
{
func
(
b
*
OIDCBackend
)
NewOIDCSession
(
arguments
json
.
RawMessage
)
(
s
*
Session
,
err
error
)
{
os
:=
&
OIDCSession
{
backend
:
b
}
if
os
.
nonce
,
err
=
generateRandomString
(
16
);
err
!=
nil
{
return
}
if
arguments
!=
nil
{
os
.
token
=
&
oauth2
.
Token
{}
if
err
=
json
.
Unmarshal
(
arguments
,
os
.
token
);
err
!=
nil
{
return
nil
,
errors
.
New
(
"failed to parse Oauth2 Token: "
+
err
.
Error
())
}
}
if
s
,
err
=
NewSession
();
err
!=
nil
{
return
...
...
@@ -119,6 +126,11 @@ func (b *OIDCBackend) NewOIDCSession() (s *Session, err error) {
return
nil
,
err
}
if
os
.
token
!=
nil
{
// TODO: get fetch OIDC UserInfo and set the session state to logged-in!
return
}
time
.
AfterFunc
(
b
.
loginTimeout
,
func
()
{
if
s
.
updateState
(
SessionStateNew
,
SessionStateLoginTimeout
)
{
return
...
...
This diff is collapsed.
Click to expand it.
auth/utils.go
+
2
−
1
View file @
35c218ac
...
...
@@ -51,7 +51,8 @@ type AuthBackendInfo struct {
}
type
NewSessionRequest
struct
{
Backend
string
`json:"backend"`
Backend
string
`json:"backend"`
Arguments
json
.
RawMessage
`json:"arguments"`
}
type
NewSessionResponse
struct
{
...
...
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