mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-22 11:08:10 +02:00
Merge branch 'wasaga/mcp-client-registration' into wasaga/mcp-authorize-request
This commit is contained in:
commit
52af622cc4
6 changed files with 114 additions and 1405 deletions
|
@ -4,23 +4,24 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/zeebo/assert"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/pomerium/pomerium/internal/oauth21"
|
||||
"github.com/pomerium/pomerium/internal/oauth21/gen"
|
||||
rfc7591v1 "github.com/pomerium/pomerium/internal/rfc7591"
|
||||
)
|
||||
|
||||
func ValidateClientTest(t *testing.T) {
|
||||
func TestValidateRequest(t *testing.T) {
|
||||
t.Parallel()
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
client *rfc7591v1.ClientRegistrationRequest
|
||||
client *rfc7591v1.ClientMetadata
|
||||
req *gen.AuthorizationRequest
|
||||
err bool
|
||||
}{
|
||||
{
|
||||
"optional redirect_uri, multiple redirect_uris",
|
||||
&rfc7591v1.ClientRegistrationRequest{
|
||||
&rfc7591v1.ClientMetadata{
|
||||
RedirectUris: []string{"https://example.com/callback", "https://example.com/other-callback"},
|
||||
},
|
||||
&gen.AuthorizationRequest{
|
||||
|
@ -28,6 +29,36 @@ func ValidateClientTest(t *testing.T) {
|
|||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"optional redirect_uri, single redirect_uri",
|
||||
&rfc7591v1.ClientMetadata{
|
||||
RedirectUris: []string{"https://example.com/callback"},
|
||||
},
|
||||
&gen.AuthorizationRequest{
|
||||
RedirectUri: nil,
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"matching redirect_uri",
|
||||
&rfc7591v1.ClientMetadata{
|
||||
RedirectUris: []string{"https://example.com/callback", "https://example.com/other-callback"},
|
||||
},
|
||||
&gen.AuthorizationRequest{
|
||||
RedirectUri: proto.String("https://example.com/callback"),
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"non-matching redirect_uri",
|
||||
&rfc7591v1.ClientMetadata{
|
||||
RedirectUris: []string{"https://example.com/callback", "https://example.com/other-callback"},
|
||||
},
|
||||
&gen.AuthorizationRequest{
|
||||
RedirectUri: proto.String("https://example.com/invalid-callback"),
|
||||
},
|
||||
true,
|
||||
},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue