Skip to content

Commit

Permalink
changed api path
Browse files Browse the repository at this point in the history
  • Loading branch information
cateiru committed Sep 28, 2022
1 parent c259fe2 commit 36d0c93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/go/sso/sso.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/golang-jwt/jwt"
)

const TOKEN_ENDPOINT = "https://api.sso.cateiru.com/oauth/token"
const PUBLIC_KEY_ENDPOINT = "https://api.sso.cateiru.com/oauth/jwt/key"
const TOKEN_ENDPOINT = "https://api.sso.cateiru.com/v1/oauth/token"
const PUBLIC_KEY_ENDPOINT = "https://api.sso.cateiru.com/v1/oauth/jwt/key"

type PublicKey struct {
Pkcs8 string `json:"pkcs8"`
Expand Down
8 changes: 4 additions & 4 deletions pkg/go/sso/sso_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestGetPublicKey(t *testing.T) {
httpmock.Activate()
defer httpmock.DeactivateAndReset()

httpmock.RegisterResponder("GET", "https://api.sso.cateiru.com/oauth/jwt/key",
httpmock.RegisterResponder("GET", "https://api.sso.cateiru.com/v1/oauth/jwt/key",
httpmock.NewStringResponder(200, `{"pkcs8": "hogehoge"}`),
)

Expand Down Expand Up @@ -99,7 +99,7 @@ func TestGetToken(t *testing.T) {
auth := "hogehoge"

httpmock.RegisterResponder("GET", fmt.Sprintf(
"https://api.sso.cateiru.com/oauth/token?grant_type=authorization_code&code=%s&redirect_uri=%s",
"https://api.sso.cateiru.com/v1/oauth/token?grant_type=authorization_code&code=%s&redirect_uri=%s",
url.QueryEscape(code), url.QueryEscape(redirect),
),
func(req *http.Request) (*http.Response, error) {
Expand Down Expand Up @@ -157,7 +157,7 @@ func TestValidateIDToken(t *testing.T) {
body, err := json.Marshal(key)
require.NoError(t, err)

httpmock.RegisterResponder("GET", "https://api.sso.cateiru.com/oauth/jwt/key",
httpmock.RegisterResponder("GET", "https://api.sso.cateiru.com/v1/oauth/jwt/key",
httpmock.NewStringResponder(200, string(body)),
)

Expand All @@ -184,7 +184,7 @@ func TestRefresh(t *testing.T) {
IDToken: "id_token",
}

httpmock.RegisterResponder("GET", fmt.Sprintf("https://api.sso.cateiru.com/oauth/token?grant_ype=refresh_token&client_id=%s&client_secret=%s&refresh_token=%s&scope=%s",
httpmock.RegisterResponder("GET", fmt.Sprintf("https://api.sso.cateiru.com/v1/oauth/token?grant_ype=refresh_token&client_id=%s&client_secret=%s&refresh_token=%s&scope=%s",
url.PathEscape(clientId), url.PathEscape(clientSecret), url.PathEscape(refreshToken), url.PathEscape(strings.Join(scope, " "))),
func(req *http.Request) (*http.Response, error) {
resp, err := httpmock.NewJsonResponse(200, successResp)
Expand Down

0 comments on commit 36d0c93

Please sign in to comment.