some comments

This commit is contained in:
Livio Amstutz 2022-04-06 11:13:07 +02:00
parent 8b1d405f91
commit b02a2701d3
No known key found for this signature in database
GPG key ID: 26BB1C2FA5952CF0
3 changed files with 10 additions and 2 deletions

View file

@ -44,7 +44,7 @@ func (c *Client) RedirectURIs() []string {
return c.redirectURIs return c.redirectURIs
} }
//PostLogoutRedirectURIs must return the registered post_logout_redirect_uris for signouts //PostLogoutRedirectURIs must return the registered post_logout_redirect_uris for sign-outs
func (c *Client) PostLogoutRedirectURIs() []string { func (c *Client) PostLogoutRedirectURIs() []string {
return []string{} return []string{}
} }
@ -160,7 +160,7 @@ func NativeClient(id string, redirectURIs ...string) *Client {
} }
} }
//WebClient will create a client of type web, which will always use PKCE and allow the use of refresh tokens //WebClient will create a client of type web, which will always use Basic Auth and allow the use of refresh tokens
//user-defined redirectURIs may include: //user-defined redirectURIs may include:
// - http://localhost with port specification (e.g. http://localhost:9999/auth/callback) // - http://localhost with port specification (e.g. http://localhost:9999/auth/callback)
//(the example will be used as default, if none is provided) //(the example will be used as default, if none is provided)

View file

@ -379,6 +379,9 @@ func (s *storage) GetKeyByIDAndUserID(ctx context.Context, keyID, userID string)
return nil, fmt.Errorf("user not found") return nil, fmt.Errorf("user not found")
} }
key, ok := service.keys[keyID] key, ok := service.keys[keyID]
if !ok {
return nil, fmt.Errorf("key not found")
}
return &jose.JSONWebKey{ return &jose.JSONWebKey{
KeyID: keyID, KeyID: keyID,
Use: "sig", Use: "sig",

View file

@ -30,8 +30,13 @@ func init() {
func main() { func main() {
ctx := context.Background() ctx := context.Background()
//this will allow us to use an issuer with http:// instead of https://
os.Setenv(op.OidcDevMode, "true") os.Setenv(op.OidcDevMode, "true")
port := "9998" port := "9998"
//the OpenID Provider requires a 32-byte key for (token) encryption
//be sure to create a proper crypto random key and manage it securely!
key := sha256.Sum256([]byte("test")) key := sha256.Sum256([]byte("test"))
router := mux.NewRouter() router := mux.NewRouter()