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
1e0ee1e4
Commit
1e0ee1e4
authored
Jul 25, 2016
by
Eric Chiang
Committed by
GitHub
Jul 25, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #522 from ericchiang/fix-connector-handlers
connector: fix path that connectors listen on
parents
216d2691
8216a3d9
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
16 deletions
+20
-16
connector_ldap.go
connector/connector_ldap.go
+3
-3
connector_local.go
connector/connector_local.go
+3
-3
connector_oauth2.go
connector/connector_oauth2.go
+2
-2
connector_oidc.go
connector/connector_oidc.go
+2
-2
interface.go
connector/interface.go
+4
-4
http_test.go
server/http_test.go
+3
-1
server.go
server/server.go
+3
-1
No files found.
connector/connector_ldap.go
View file @
1e0ee1e4
...
...
@@ -251,9 +251,9 @@ func (c *LDAPConnector) LoginURL(sessionKey, prompt string) (string, error) {
return
path
.
Join
(
c
.
namespace
.
Path
,
"login"
)
+
"?"
+
enc
,
nil
}
func
(
c
*
LDAPConnector
)
Register
(
mux
*
http
.
ServeMux
,
errorURL
url
.
URL
)
{
route
:=
path
.
Join
(
c
.
namespace
.
Path
,
"login"
)
mux
.
Handle
(
route
,
handlePasswordLogin
(
c
.
loginFunc
,
c
.
loginTpl
,
c
,
route
,
errorURL
)
)
func
(
c
*
LDAPConnector
)
Handler
(
errorURL
url
.
URL
)
http
.
Handler
{
route
:=
path
.
Join
(
c
.
namespace
.
Path
,
"
/
login"
)
return
handlePasswordLogin
(
c
.
loginFunc
,
c
.
loginTpl
,
c
,
route
,
errorURL
)
}
func
(
c
*
LDAPConnector
)
Sync
()
chan
struct
{}
{
...
...
connector/connector_local.go
View file @
1e0ee1e4
...
...
@@ -85,9 +85,9 @@ func (c *LocalConnector) LoginURL(sessionKey, prompt string) (string, error) {
return
path
.
Join
(
c
.
namespace
.
Path
,
"login"
)
+
"?"
+
enc
,
nil
}
func
(
c
*
LocalConnector
)
Register
(
mux
*
http
.
ServeMux
,
errorURL
url
.
URL
)
{
route
:=
c
.
namespace
.
Path
+
"/login"
mux
.
Handle
(
route
,
handlePasswordLogin
(
c
.
loginFunc
,
c
.
loginTpl
,
c
.
idp
,
route
,
errorURL
)
)
func
(
c
*
LocalConnector
)
Handler
(
errorURL
url
.
URL
)
http
.
Handler
{
route
:=
path
.
Join
(
c
.
namespace
.
Path
,
"/login"
)
return
handlePasswordLogin
(
c
.
loginFunc
,
c
.
loginTpl
,
c
.
idp
,
route
,
errorURL
)
}
func
(
c
*
LocalConnector
)
Sync
()
chan
struct
{}
{
...
...
connector/connector_oauth2.go
View file @
1e0ee1e4
...
...
@@ -53,8 +53,8 @@ func (c *OAuth2Connector) LoginURL(sessionKey, prompt string) (string, error) {
return
c
.
conn
.
Client
()
.
AuthCodeURL
(
sessionKey
,
oauth2
.
GrantTypeAuthCode
,
prompt
),
nil
}
func
(
c
*
OAuth2Connector
)
Register
(
mux
*
http
.
ServeMux
,
errorURL
url
.
URL
)
{
mux
.
Handle
(
c
.
cbURL
.
Path
,
c
.
handleCallbackFunc
(
c
.
loginFunc
,
errorURL
)
)
func
(
c
*
OAuth2Connector
)
Handler
(
errorURL
url
.
URL
)
http
.
Handler
{
return
c
.
handleCallbackFunc
(
c
.
loginFunc
,
errorURL
)
}
func
(
c
*
OAuth2Connector
)
handleCallbackFunc
(
lf
oidc
.
LoginFunc
,
errorURL
url
.
URL
)
http
.
HandlerFunc
{
...
...
connector/connector_oidc.go
View file @
1e0ee1e4
...
...
@@ -90,8 +90,8 @@ func (c *OIDCConnector) LoginURL(sessionKey, prompt string) (string, error) {
return
oac
.
AuthCodeURL
(
sessionKey
,
""
,
prompt
),
nil
}
func
(
c
*
OIDCConnector
)
Register
(
mux
*
http
.
ServeMux
,
errorURL
url
.
URL
)
{
mux
.
Handle
(
c
.
cbURL
.
Path
,
c
.
handleCallbackFunc
(
c
.
loginFunc
,
errorURL
)
)
func
(
c
*
OIDCConnector
)
Handler
(
errorURL
url
.
URL
)
http
.
Handler
{
return
c
.
handleCallbackFunc
(
c
.
loginFunc
,
errorURL
)
}
func
(
c
*
OIDCConnector
)
Sync
()
chan
struct
{}
{
...
...
connector/interface.go
View file @
1e0ee1e4
...
...
@@ -21,12 +21,12 @@ type Connector interface {
// and OAuth2 prompt type.
LoginURL
(
sessionKey
,
prompt
string
)
(
string
,
error
)
//
Regist
er allows connectors to register a callback handler with the
//
Handl
er allows connectors to register a callback handler with the
// dex server.
//
// Connectors
should register with a path that extends the namespace
//
URL provided
when the Connector is instantiated.
Register
(
mux
*
http
.
ServeMux
,
errorURL
url
.
URL
)
// Connectors
will handle any path that extends the namespace URL provided
// when the Connector is instantiated.
Handler
(
errorURL
url
.
URL
)
http
.
Handler
// Sync triggers any long-running tasks needed to maintain the
// Connector's operation. For example, this would encompass
...
...
server/http_test.go
View file @
1e0ee1e4
...
...
@@ -40,7 +40,9 @@ func (f *fakeConnector) LoginURL(sessionKey, prompt string) (string, error) {
return
f
.
loginURL
,
nil
}
func
(
f
*
fakeConnector
)
Register
(
mux
*
http
.
ServeMux
,
errorURL
url
.
URL
)
{}
func
(
f
*
fakeConnector
)
Handler
(
errorURL
url
.
URL
)
http
.
Handler
{
return
http
.
HandlerFunc
(
http
.
NotFound
)
}
func
(
f
*
fakeConnector
)
Sync
()
chan
struct
{}
{
return
nil
...
...
server/server.go
View file @
1e0ee1e4
...
...
@@ -269,7 +269,9 @@ func (s *Server) HTTPHandler() http.Handler {
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
idpc
.
Register
(
mux
,
*
errorURL
)
// NOTE(ericchiang): This path MUST end in a "/" in order to indicate a
// path prefix rather than an absolute path.
mux
.
Handle
(
path
.
Join
(
httpPathAuth
,
idpc
.
ID
())
+
"/"
,
idpc
.
Handler
(
*
errorURL
))
}
apiBasePath
:=
path
.
Join
(
httpPathAPI
,
APIVersion
)
...
...
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