Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
go-sso
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
id
go-sso
Commits
f144f4dc
Commit
f144f4dc
authored
Nov 20, 2018
by
ale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tracing support to auth-server requests
parent
ad4e6235
Pipeline
#1599
passed with stages
in 1 minute and 42 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
1 deletion
+26
-1
server/login.go
server/login.go
+26
-1
No files found.
server/login.go
View file @
f144f4dc
...
...
@@ -16,6 +16,7 @@ import (
"github.com/gorilla/csrf"
"github.com/gorilla/sessions"
"github.com/tstranex/u2f"
"go.opencensus.io/trace"
"git.autistici.org/id/auth"
authclient
"git.autistici.org/id/auth/client"
...
...
@@ -293,7 +294,31 @@ func (l *loginHandler) makeAuthRequest(w http.ResponseWriter, req *http.Request,
U2FResponse
:
u2fResponse
,
U2FAppID
:
appID
,
}
return
l
.
authClient
.
Authenticate
(
req
.
Context
(),
&
ar
)
// Trace the authentication request.
ctx
,
span
:=
trace
.
StartSpan
(
req
.
Context
(),
"auth"
,
trace
.
WithSpanKind
(
trace
.
SpanKindClient
))
span
.
AddAttributes
(
trace
.
StringAttribute
(
"auth.user"
,
username
),
trace
.
StringAttribute
(
"auth.service"
,
l
.
authService
),
trace
.
BoolAttribute
(
"auth.with_password"
,
len
(
password
)
>
0
),
trace
.
BoolAttribute
(
"auth.with_otp"
,
otp
!=
""
),
trace
.
BoolAttribute
(
"auth.with_u2f"
,
u2fResponse
!=
nil
),
)
defer
span
.
End
()
resp
,
err
:=
l
.
authClient
.
Authenticate
(
ctx
,
&
ar
)
// Record the authentication response status in the trace.
if
err
!=
nil
{
span
.
SetStatus
(
trace
.
Status
{
Code
:
trace
.
StatusCodeUnknown
,
Message
:
err
.
Error
()})
}
else
if
resp
.
Status
==
auth
.
StatusOK
{
span
.
SetStatus
(
trace
.
Status
{
Code
:
trace
.
StatusCodeOK
,
Message
:
"OK"
})
}
else
{
span
.
SetStatus
(
trace
.
Status
{
Code
:
trace
.
StatusCodePermissionDenied
,
Message
:
resp
.
Status
.
String
()})
}
return
resp
,
err
}
// Return a (relative) URL that will redirect the user to the login
...
...
Write
Preview
Markdown
is supported
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