spelling: register
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
This commit is contained in:
parent
6790aea260
commit
c79b40ad56
@ -353,7 +353,7 @@ func (m *UpdateClientReq) GetLogoUrl() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateClientResp returns the reponse from updating a client.
|
// UpdateClientResp returns the response from updating a client.
|
||||||
type UpdateClientResp struct {
|
type UpdateClientResp struct {
|
||||||
NotFound bool `protobuf:"varint,1,opt,name=not_found,json=notFound,proto3" json:"not_found,omitempty"`
|
NotFound bool `protobuf:"varint,1,opt,name=not_found,json=notFound,proto3" json:"not_found,omitempty"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
@ -45,7 +45,7 @@ message UpdateClientReq {
|
|||||||
string logo_url = 5;
|
string logo_url = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateClientResp returns the reponse from updating a client.
|
// UpdateClientResp returns the response from updating a client.
|
||||||
message UpdateClientResp {
|
message UpdateClientResp {
|
||||||
bool not_found = 1;
|
bool not_found = 1;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ func (m *UpdateClientReq) GetLogoUrl() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateClientResp returns the reponse from updating a client.
|
// UpdateClientResp returns the response from updating a client.
|
||||||
type UpdateClientResp struct {
|
type UpdateClientResp struct {
|
||||||
NotFound bool `protobuf:"varint,1,opt,name=not_found,json=notFound,proto3" json:"not_found,omitempty"`
|
NotFound bool `protobuf:"varint,1,opt,name=not_found,json=notFound,proto3" json:"not_found,omitempty"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
@ -45,7 +45,7 @@ message UpdateClientReq {
|
|||||||
string logo_url = 5;
|
string logo_url = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateClientResp returns the reponse from updating a client.
|
// UpdateClientResp returns the response from updating a client.
|
||||||
message UpdateClientResp {
|
message UpdateClientResp {
|
||||||
bool not_found = 1;
|
bool not_found = 1;
|
||||||
}
|
}
|
||||||
|
@ -855,7 +855,7 @@ func (s *Server) handleAuthCode(w http.ResponseWriter, r *http.Request, client s
|
|||||||
s.writeAccessToken(w, tokenResponse)
|
s.writeAccessToken(w, tokenResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) exchangeAuthCode(w http.ResponseWriter, authCode storage.AuthCode, client storage.Client) (*accessTokenReponse, error) {
|
func (s *Server) exchangeAuthCode(w http.ResponseWriter, authCode storage.AuthCode, client storage.Client) (*accessTokenResponse, error) {
|
||||||
accessToken, err := s.newAccessToken(client.ID, authCode.Claims, authCode.Scopes, authCode.Nonce, authCode.ConnectorID)
|
accessToken, err := s.newAccessToken(client.ID, authCode.Claims, authCode.Scopes, authCode.Nonce, authCode.ConnectorID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.logger.Errorf("failed to create new access token: %v", err)
|
s.logger.Errorf("failed to create new access token: %v", err)
|
||||||
@ -1449,7 +1449,7 @@ func (s *Server) handlePasswordGrant(w http.ResponseWriter, r *http.Request, cli
|
|||||||
s.writeAccessToken(w, resp)
|
s.writeAccessToken(w, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
type accessTokenReponse struct {
|
type accessTokenResponse struct {
|
||||||
AccessToken string `json:"access_token"`
|
AccessToken string `json:"access_token"`
|
||||||
TokenType string `json:"token_type"`
|
TokenType string `json:"token_type"`
|
||||||
ExpiresIn int `json:"expires_in"`
|
ExpiresIn int `json:"expires_in"`
|
||||||
@ -1457,8 +1457,8 @@ type accessTokenReponse struct {
|
|||||||
IDToken string `json:"id_token"`
|
IDToken string `json:"id_token"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) toAccessTokenResponse(idToken, accessToken, refreshToken string, expiry time.Time) *accessTokenReponse {
|
func (s *Server) toAccessTokenResponse(idToken, accessToken, refreshToken string, expiry time.Time) *accessTokenResponse {
|
||||||
return &accessTokenReponse{
|
return &accessTokenResponse{
|
||||||
accessToken,
|
accessToken,
|
||||||
"bearer",
|
"bearer",
|
||||||
int(expiry.Sub(s.now()).Seconds()),
|
int(expiry.Sub(s.now()).Seconds()),
|
||||||
@ -1467,7 +1467,7 @@ func (s *Server) toAccessTokenResponse(idToken, accessToken, refreshToken string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) writeAccessToken(w http.ResponseWriter, resp *accessTokenReponse) {
|
func (s *Server) writeAccessToken(w http.ResponseWriter, resp *accessTokenResponse) {
|
||||||
data, err := json.Marshal(resp)
|
data, err := json.Marshal(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.logger.Errorf("failed to marshal access token response: %v", err)
|
s.logger.Errorf("failed to marshal access token response: %v", err)
|
||||||
|
@ -721,7 +721,7 @@ func TestOAuth2CodeFlow(t *testing.T) {
|
|||||||
|
|
||||||
defer oauth2Client.Close()
|
defer oauth2Client.Close()
|
||||||
|
|
||||||
// Regester the client above with dex.
|
// Register the client above with dex.
|
||||||
redirectURL := oauth2Client.URL + "/callback"
|
redirectURL := oauth2Client.URL + "/callback"
|
||||||
client := storage.Client{
|
client := storage.Client{
|
||||||
ID: clientID,
|
ID: clientID,
|
||||||
@ -1560,7 +1560,7 @@ func TestOAuth2DeviceFlow(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse the response
|
// Parse the response
|
||||||
var tokenRes accessTokenReponse
|
var tokenRes accessTokenResponse
|
||||||
if err := json.Unmarshal(responseBody, &tokenRes); err != nil {
|
if err := json.Unmarshal(responseBody, &tokenRes); err != nil {
|
||||||
t.Errorf("Unexpected Device Access Token Response Format %v", string(responseBody))
|
t.Errorf("Unexpected Device Access Token Response Format %v", string(responseBody))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user