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
435cadfc
Commit
435cadfc
authored
Jul 26, 2016
by
Eric Chiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*: more updates to prepend the correct API path
parent
ede6300a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
5 deletions
+14
-5
main.go
examples/app/main.go
+2
-1
register.go
server/register.go
+2
-1
server.go
server/server.go
+9
-2
reset-password.html
static/html/reset-password.html
+1
-1
No files found.
examples/app/main.go
View file @
435cadfc
...
@@ -16,6 +16,7 @@ import (
...
@@ -16,6 +16,7 @@ import (
"net/http"
"net/http"
"net/url"
"net/url"
"os"
"os"
"path"
"strings"
"strings"
"time"
"time"
...
@@ -181,7 +182,7 @@ func NewClientHandler(c *oidc.Client, issuer string, cbURL url.URL) http.Handler
...
@@ -181,7 +182,7 @@ func NewClientHandler(c *oidc.Client, issuer string, cbURL url.URL) http.Handler
}
}
resendURL
:=
*
issuerURL
resendURL
:=
*
issuerURL
resendURL
.
Path
=
"/resend-verify-email"
resendURL
.
Path
=
path
.
Join
(
resendURL
.
Path
,
"/resend-verify-email"
)
mux
.
HandleFunc
(
"/resend"
,
handleResendFunc
(
c
,
*
issuerURL
,
resendURL
,
cbURL
))
mux
.
HandleFunc
(
"/resend"
,
handleResendFunc
(
c
,
*
issuerURL
,
resendURL
,
cbURL
))
return
mux
return
mux
...
...
server/register.go
View file @
435cadfc
...
@@ -5,6 +5,7 @@ import (
...
@@ -5,6 +5,7 @@ import (
"fmt"
"fmt"
"net/http"
"net/http"
"net/url"
"net/url"
"path"
"strings"
"strings"
"github.com/coreos/dex/connector"
"github.com/coreos/dex/connector"
...
@@ -336,7 +337,7 @@ func getConnectorForUserByEmail(ur user.UserRepo, email string) (string, error)
...
@@ -336,7 +337,7 @@ func getConnectorForUserByEmail(ur user.UserRepo, email string) (string, error)
func
newLoginURLFromSession
(
issuer
url
.
URL
,
ses
*
session
.
Session
,
register
bool
,
connectorFilter
[]
string
,
msgCode
string
)
*
url
.
URL
{
func
newLoginURLFromSession
(
issuer
url
.
URL
,
ses
*
session
.
Session
,
register
bool
,
connectorFilter
[]
string
,
msgCode
string
)
*
url
.
URL
{
loginURL
:=
issuer
loginURL
:=
issuer
v
:=
loginURL
.
Query
()
v
:=
loginURL
.
Query
()
loginURL
.
Path
=
httpPathAuth
loginURL
.
Path
=
path
.
Join
(
loginURL
.
Path
,
httpPathAuth
)
v
.
Set
(
"redirect_uri"
,
ses
.
RedirectURL
.
String
())
v
.
Set
(
"redirect_uri"
,
ses
.
RedirectURL
.
String
())
v
.
Set
(
"state"
,
ses
.
ClientState
)
v
.
Set
(
"state"
,
ses
.
ClientState
)
v
.
Set
(
"client_id"
,
ses
.
ClientID
)
v
.
Set
(
"client_id"
,
ses
.
ClientID
)
...
...
server/server.go
View file @
435cadfc
...
@@ -8,6 +8,7 @@ import (
...
@@ -8,6 +8,7 @@ import (
"net/url"
"net/url"
"path"
"path"
"sort"
"sort"
"strings"
"time"
"time"
"github.com/coreos/go-oidc/jose"
"github.com/coreos/go-oidc/jose"
...
@@ -215,7 +216,13 @@ func (s *Server) HTTPHandler() http.Handler {
...
@@ -215,7 +216,13 @@ func (s *Server) HTTPHandler() http.Handler {
clock
:=
clockwork
.
NewRealClock
()
clock
:=
clockwork
.
NewRealClock
()
mux
:=
http
.
NewServeMux
()
mux
:=
http
.
NewServeMux
()
handle
:=
func
(
urlPath
string
,
h
http
.
Handler
)
{
handle
:=
func
(
urlPath
string
,
h
http
.
Handler
)
{
mux
.
Handle
(
path
.
Join
(
s
.
IssuerURL
.
Path
,
urlPath
),
h
)
p
:=
path
.
Join
(
s
.
IssuerURL
.
Path
,
urlPath
)
// path.Join always trims trailing slashes (https://play.golang.org/p/GRr0jDd9P7).
// If path being registered has a trailing slash, add it back on.
if
strings
.
HasSuffix
(
urlPath
,
"/"
)
{
p
=
p
+
"/"
}
mux
.
Handle
(
p
,
h
)
}
}
handleFunc
:=
func
(
urlPath
string
,
hf
http
.
HandlerFunc
)
{
handleFunc
:=
func
(
urlPath
string
,
hf
http
.
HandlerFunc
)
{
handle
(
urlPath
,
hf
)
handle
(
urlPath
,
hf
)
...
@@ -277,7 +284,7 @@ func (s *Server) HTTPHandler() http.Handler {
...
@@ -277,7 +284,7 @@ func (s *Server) HTTPHandler() http.Handler {
}
}
// NOTE(ericchiang): This path MUST end in a "/" in order to indicate a
// NOTE(ericchiang): This path MUST end in a "/" in order to indicate a
// path prefix rather than an absolute path.
// path prefix rather than an absolute path.
mux
.
H
andle
(
path
.
Join
(
httpPathAuth
,
idpc
.
ID
())
+
"/"
,
idpc
.
Handler
(
*
errorURL
))
h
andle
(
path
.
Join
(
httpPathAuth
,
idpc
.
ID
())
+
"/"
,
idpc
.
Handler
(
*
errorURL
))
}
}
apiBasePath
:=
path
.
Join
(
httpPathAPI
,
APIVersion
)
apiBasePath
:=
path
.
Join
(
httpPathAPI
,
APIVersion
)
...
...
static/html/reset-password.html
View file @
435cadfc
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
{{ end }}
{{ end }}
{{ else }}
{{ else }}
<h2
class=
"heading"
>
Reset your password
</h2>
<h2
class=
"heading"
>
Reset your password
</h2>
<form
onsubmit=
"return validate();"
id=
"resetPasswordForm"
method=
"POST"
action=
"/reset-password
"
>
<form
onsubmit=
"return validate();"
id=
"resetPasswordForm"
method=
"POST"
action=
"{{ "
/
reset-password
"
|
absPath
}}
"
>
<div
class=
"form-row"
>
<div
class=
"form-row"
>
<div
class=
"input-desc"
>
<div
class=
"input-desc"
>
<label
for=
"password"
>
New Password
</label>
<label
for=
"password"
>
New Password
</label>
...
...
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