Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
go-sso
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
id
go-sso
Commits
7c359bdb
Commit
7c359bdb
authored
6 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Log keystore.Open on successful login
parent
a7e8bbce
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/http.go
+6
-2
6 additions, 2 deletions
server/http.go
with
6 additions
and
2 deletions
server/http.go
+
6
−
2
View file @
7c359bdb
...
...
@@ -146,15 +146,17 @@ func New(loginService *LoginService, authClient authclient.Client, config *Confi
}
func
(
h
*
Server
)
loginCallback
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
,
username
,
password
string
,
userinfo
*
auth
.
UserInfo
)
error
{
log
.
Printf
(
"successful login for user %s"
,
username
)
// Open the keystore for this user with the password used to
// authenticate. Set the TTL to the duration of the
// authenticated session.
var
kmsg
string
if
h
.
keystore
!=
nil
{
var
shard
string
if
userinfo
!=
nil
{
shard
=
userinfo
.
Shard
kmsg
=
fmt
.
Sprintf
(
" (unlocked key on shard %s)"
,
shard
)
}
else
{
kmsg
=
" (unlocked key)"
}
if
err
:=
h
.
keystore
.
Open
(
req
.
Context
(),
shard
,
username
,
password
,
int
(
h
.
authSessionLifetime
.
Seconds
()));
err
!=
nil
{
log
.
Printf
(
"failed to unlock keystore for user %s: %v"
,
username
,
err
)
...
...
@@ -162,6 +164,8 @@ func (h *Server) loginCallback(w http.ResponseWriter, req *http.Request, usernam
}
}
log
.
Printf
(
"successful login for user %s%s"
,
username
,
kmsg
)
// Create cookie-based session for the authenticated user.
session
:=
newAuthSession
(
h
.
authSessionLifetime
,
username
,
userinfo
)
httpSession
,
_
:=
h
.
authSessionStore
.
Get
(
req
,
authSessionKey
)
// nolint
...
...
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