Skip to content

Commit

Permalink
Merge pull request #107 from cateiru/add-api-prefix
Browse files Browse the repository at this point in the history
changed api path
  • Loading branch information
cateiru authored Sep 28, 2022
2 parents c259fe2 + 36d0c93 commit f28940e
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

1 comment on commit f28940e

@vercel
Copy link

@vercel vercel bot commented on f28940e Sep 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

cateiru-sso – ./

cateiru-sso-git-main-cateiru.vercel.app
cateiru-sso-cateiru.vercel.app
sso.cateiru.com

Please sign in to comment.