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
38fc85d6
Commit
38fc85d6
authored
May 02, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final tweaks to auth proxy feature
parent
be589d81
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
7 deletions
+16
-7
conf/defaults.ini
+1
-1
conf/sample.ini
+7
-0
pkg/middleware/auth_proxy.go
+3
-1
pkg/services/sqlstore/user.go
+5
-5
No files found.
conf/defaults.ini
View file @
38fc85d6
...
...
@@ -164,7 +164,7 @@ allowed_domains =
#################################### Auth Proxy ##########################
[auth.proxy]
enabled
=
false
;
enabled
=
false
header_name
=
X-WEBAUTH-USER
header_property
=
username
auto_sign_up
=
true
...
...
conf/sample.ini
View file @
38fc85d6
...
...
@@ -161,6 +161,13 @@
;api_url = https://www.googleapis.com/oauth2/v1/userinfo
;allowed_domains =
#################################### Auth Proxy ##########################
[auth.proxy]
;enabled = false
;header_name = X-WEBAUTH-USER
;header_property = username
;auto_sign_up = true
#################################### Logging ##########################
[log]
# Either "console", "file", default is "console"
...
...
pkg/middleware/auth_proxy.go
View file @
38fc85d6
...
...
@@ -12,7 +12,7 @@ func initContextWithAuthProxy(ctx *Context) bool {
}
proxyHeaderValue
:=
ctx
.
Req
.
Header
.
Get
(
setting
.
AuthProxyHeaderName
)
if
len
(
proxyHeaderValue
)
<
=
0
{
if
len
(
proxyHeaderValue
)
=
=
0
{
return
false
}
...
...
@@ -34,6 +34,8 @@ func initContextWithAuthProxy(ctx *Context) bool {
ctx
.
Handle
(
500
,
"Failed find user after creation"
,
err
)
return
true
}
}
else
{
return
false
}
}
...
...
pkg/services/sqlstore/user.go
View file @
38fc85d6
...
...
@@ -265,17 +265,17 @@ func GetSignedInUser(query *m.GetSignedInUserQuery) error {
LEFT OUTER JOIN org_user on org_user.org_id = u.org_id and org_user.user_id = u.id
LEFT OUTER JOIN org on org.id = u.org_id `
sess
:=
x
.
Table
(
"user"
)
if
query
.
UserId
>
0
{
rawSql
+=
"WHERE u.id=?"
sess
.
Sql
(
rawSql
+
"WHERE u.id=?"
,
query
.
UserId
)
}
else
if
query
.
Login
!=
""
{
rawSql
+=
"WHERE u.login=?"
sess
.
Sql
(
rawSql
+
"WHERE u.login=?"
,
query
.
Login
)
}
else
if
query
.
Email
!=
""
{
rawSql
+=
"WHERE u.email=?"
sess
.
Sql
(
rawSql
+
"WHERE u.email=?"
,
query
.
Email
)
}
var
user
m
.
SignedInUser
sess
:=
x
.
Table
(
"user"
)
has
,
err
:=
sess
.
Sql
(
rawSql
,
query
.
UserId
)
.
Get
(
&
user
)
has
,
err
:=
sess
.
Get
(
&
user
)
if
err
!=
nil
{
return
err
}
else
if
!
has
{
...
...
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