Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
0848ba2e
Commit
0848ba2e
authored
Oct 12, 2017
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oauth: provide more logging for failed oauth requests
parent
23c61001
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
pkg/api/login_oauth.go
+8
-6
No files found.
pkg/api/login_oauth.go
View file @
0848ba2e
...
...
@@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
...
...
@@ -16,6 +15,7 @@ import (
"golang.org/x/oauth2"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/middleware"
m
"github.com/grafana/grafana/pkg/models"
...
...
@@ -29,6 +29,7 @@ var (
ErrSignUpNotAllowed
=
errors
.
New
(
"Signup is not allowed for this adapter"
)
ErrUsersQuotaReached
=
errors
.
New
(
"Users quota reached"
)
ErrNoEmail
=
errors
.
New
(
"Login provider didn't return an email address"
)
oauthLogger
=
log
.
New
(
"oauth.login"
)
)
func
GenStateString
()
string
{
...
...
@@ -50,10 +51,11 @@ func OAuthLogin(ctx *middleware.Context) {
return
}
error
:=
ctx
.
Query
(
"error"
)
if
error
!=
""
{
error
Param
:=
ctx
.
Query
(
"error"
)
if
error
Param
!=
""
{
errorDesc
:=
ctx
.
Query
(
"error_description"
)
redirectWithError
(
ctx
,
ErrProviderDeniedRequest
,
"error"
,
error
,
"errorDesc"
,
errorDesc
)
oauthLogger
.
Error
(
"failed to login "
,
"error"
,
errorParam
,
"errorDesc"
,
errorDesc
)
redirectWithError
(
ctx
,
ErrProviderDeniedRequest
,
"error"
,
errorParam
,
"errorDesc"
,
errorDesc
)
return
}
...
...
@@ -90,7 +92,7 @@ func OAuthLogin(ctx *middleware.Context) {
if
setting
.
OAuthService
.
OAuthInfos
[
name
]
.
TlsClientCert
!=
""
||
setting
.
OAuthService
.
OAuthInfos
[
name
]
.
TlsClientKey
!=
""
{
cert
,
err
:=
tls
.
LoadX509KeyPair
(
setting
.
OAuthService
.
OAuthInfos
[
name
]
.
TlsClientCert
,
setting
.
OAuthService
.
OAuthInfos
[
name
]
.
TlsClientKey
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
1
,
"Failed to setup TlsClientCert"
,
"oauth provider"
,
name
,
"error"
,
err
)
}
tr
.
TLSClientConfig
.
Certificates
=
append
(
tr
.
TLSClientConfig
.
Certificates
,
cert
)
...
...
@@ -99,7 +101,7 @@ func OAuthLogin(ctx *middleware.Context) {
if
setting
.
OAuthService
.
OAuthInfos
[
name
]
.
TlsClientCa
!=
""
{
caCert
,
err
:=
ioutil
.
ReadFile
(
setting
.
OAuthService
.
OAuthInfos
[
name
]
.
TlsClientCa
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
1
,
"Failed to setup TlsClientCa"
,
"oauth provider"
,
name
,
"error"
,
err
)
}
caCertPool
:=
x509
.
NewCertPool
()
caCertPool
.
AppendCertsFromPEM
(
caCert
)
...
...
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