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
dfa840d2
Commit
dfa840d2
authored
Aug 24, 2016
by
Eric Chiang
Committed by
GitHub
Aug 24, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #566 from ericchiang/dev-clean-up-oauth2-values
dev branch: fix oauth2 values and remove unused code
parents
f219964f
c33ad3e0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
23 deletions
+3
-23
handlers.go
server/handlers.go
+2
-2
oauth2.go
server/oauth2.go
+1
-21
No files found.
server/handlers.go
View file @
dfa840d2
...
...
@@ -386,9 +386,9 @@ func (s *Server) handleToken(w http.ResponseWriter, r *http.Request) {
grantType
:=
r
.
PostFormValue
(
"grant_type"
)
switch
grantType
{
case
"authorization_code"
:
case
grantTypeAuthorizationCode
:
s
.
handleAuthCode
(
w
,
r
,
client
)
case
"refresh_token"
:
case
grantTypeRefreshToken
:
s
.
handleRefreshToken
(
w
,
r
,
client
)
default
:
tokenErr
(
w
,
errInvalidGrant
,
""
,
http
.
StatusBadRequest
)
...
...
server/oauth2.go
View file @
dfa840d2
...
...
@@ -78,7 +78,7 @@ const (
)
const
(
grantTypeAuthorizationCode
=
"code"
grantTypeAuthorizationCode
=
"
authorization_
code"
grantTypeRefreshToken
=
"refresh_token"
)
...
...
@@ -317,23 +317,3 @@ func validateRedirectURI(client storage.Client, redirectURI string) bool {
n
,
err
:=
strconv
.
Atoi
(
strings
.
TrimPrefix
(
redirectURI
,
"https://localhost:"
))
return
err
==
nil
&&
n
<=
0
}
type
tokenRequest
struct
{
Client
storage
.
Client
IsRefresh
bool
Token
string
RedirectURI
string
Scopes
[]
string
}
func
handleTokenRequest
(
s
storage
.
Storage
,
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
*
authErr
{
return
nil
}
func
handleRefreshRequest
(
s
storage
.
Storage
,
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
client
storage
.
Client
)
*
authErr
{
return
nil
}
func
handleCodeRequest
(
s
storage
.
Storage
,
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
client
storage
.
Client
)
*
authErr
{
return
nil
}
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