2020-11-11 22:49:24 +00:00
|
|
|
// Copyright 2020 the Pinniped contributors. All Rights Reserved.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
package oidc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/ory/fosite"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNullStorage_GetClient(t *testing.T) {
|
|
|
|
storage := NullStorage{}
|
|
|
|
|
|
|
|
client, err := storage.GetClient(context.Background(), "some-other-client")
|
|
|
|
require.Equal(t, fosite.ErrNotFound, err)
|
|
|
|
require.Zero(t, client)
|
|
|
|
|
|
|
|
client, err = storage.GetClient(context.Background(), "pinniped-cli")
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.Equal(t,
|
|
|
|
&fosite.DefaultOpenIDConnectClient{
|
|
|
|
DefaultClient: &fosite.DefaultClient{
|
|
|
|
ID: "pinniped-cli",
|
|
|
|
Public: true,
|
|
|
|
RedirectURIs: []string{"http://127.0.0.1/callback"},
|
|
|
|
ResponseTypes: []string{"code"},
|
2020-12-09 01:33:08 +00:00
|
|
|
GrantTypes: []string{"authorization_code", "refresh_token", "urn:ietf:params:oauth:grant-type:token-exchange"},
|
2020-12-09 15:12:32 +00:00
|
|
|
Scopes: []string{"openid", "offline_access", "profile", "email", "pinniped.sts.unrestricted"},
|
2020-11-11 22:49:24 +00:00
|
|
|
},
|
2020-12-02 16:16:02 +00:00
|
|
|
TokenEndpointAuthMethod: "none",
|
2020-11-11 22:49:24 +00:00
|
|
|
},
|
|
|
|
client,
|
|
|
|
)
|
|
|
|
}
|