Commit dfa840d2 authored by Eric Chiang's avatar Eric Chiang Committed by GitHub

Merge pull request #566 from ericchiang/dev-clean-up-oauth2-values

dev branch: fix oauth2 values and remove unused code
parents f219964f c33ad3e0
...@@ -386,9 +386,9 @@ func (s *Server) handleToken(w http.ResponseWriter, r *http.Request) { ...@@ -386,9 +386,9 @@ func (s *Server) handleToken(w http.ResponseWriter, r *http.Request) {
grantType := r.PostFormValue("grant_type") grantType := r.PostFormValue("grant_type")
switch grantType { switch grantType {
case "authorization_code": case grantTypeAuthorizationCode:
s.handleAuthCode(w, r, client) s.handleAuthCode(w, r, client)
case "refresh_token": case grantTypeRefreshToken:
s.handleRefreshToken(w, r, client) s.handleRefreshToken(w, r, client)
default: default:
tokenErr(w, errInvalidGrant, "", http.StatusBadRequest) tokenErr(w, errInvalidGrant, "", http.StatusBadRequest)
......
...@@ -78,7 +78,7 @@ const ( ...@@ -78,7 +78,7 @@ const (
) )
const ( const (
grantTypeAuthorizationCode = "code" grantTypeAuthorizationCode = "authorization_code"
grantTypeRefreshToken = "refresh_token" grantTypeRefreshToken = "refresh_token"
) )
...@@ -317,23 +317,3 @@ func validateRedirectURI(client storage.Client, redirectURI string) bool { ...@@ -317,23 +317,3 @@ func validateRedirectURI(client storage.Client, redirectURI string) bool {
n, err := strconv.Atoi(strings.TrimPrefix(redirectURI, "https://localhost:")) n, err := strconv.Atoi(strings.TrimPrefix(redirectURI, "https://localhost:"))
return err == nil && n <= 0 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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment