Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
dex
Commits
7525e562
Commit
7525e562
authored
Aug 19, 2016
by
Eric Chiang
Committed by
GitHub
Aug 19, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #560 from ericchiang/fix-user-api
server: fix the path registration for user APIs at non-root URLs
parents
b33227bc
b466ae7a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
server.go
server/server.go
+11
-1
No files found.
server/server.go
View file @
7525e562
...
...
@@ -215,6 +215,8 @@ func (s *Server) HTTPHandler() http.Handler {
clock
:=
clockwork
.
NewRealClock
()
mux
:=
http
.
NewServeMux
()
// Handler methods which register handlers at prefixed paths.
handle
:=
func
(
urlPath
string
,
h
http
.
Handler
)
{
p
:=
path
.
Join
(
s
.
IssuerURL
.
Path
,
urlPath
)
// path.Join always trims trailing slashes (https://play.golang.org/p/GRr0jDd9P7).
...
...
@@ -227,6 +229,14 @@ func (s *Server) HTTPHandler() http.Handler {
handleFunc
:=
func
(
urlPath
string
,
hf
http
.
HandlerFunc
)
{
handle
(
urlPath
,
hf
)
}
handleStripPrefix
:=
func
(
urlPath
string
,
h
http
.
Handler
)
{
if
s
.
IssuerURL
.
Path
!=
""
{
handle
(
urlPath
,
http
.
StripPrefix
(
s
.
IssuerURL
.
Path
,
h
))
}
else
{
handle
(
urlPath
,
h
)
}
}
handleFunc
(
httpPathDiscovery
,
handleDiscoveryFunc
(
s
.
ProviderConfig
()))
handleFunc
(
httpPathAuth
,
handleAuthFunc
(
s
,
s
.
Connectors
,
s
.
LoginTemplate
,
s
.
EnableRegistration
))
handleFunc
(
httpPathOOB
,
handleOOBFunc
(
s
,
s
.
OOBTemplate
))
...
...
@@ -293,7 +303,7 @@ func (s *Server) HTTPHandler() http.Handler {
usersAPI
:=
usersapi
.
NewUsersAPI
(
s
.
UserManager
,
s
.
ClientManager
,
s
.
RefreshTokenRepo
,
s
.
UserEmailer
,
s
.
localConnectorID
)
handler
:=
NewUserMgmtServer
(
usersAPI
,
s
.
JWTVerifierFactory
(),
s
.
UserManager
,
s
.
ClientManager
)
.
HTTPHandler
()
handle
(
apiBasePath
+
"/"
,
handler
)
handle
StripPrefix
(
apiBasePath
+
"/"
,
handler
)
return
http
.
Handler
(
mux
)
}
...
...
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