mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 16:59:22 +02:00
mcp: authorize request (pt2) (#5586)
This commit is contained in:
parent
63ccf6ab93
commit
9e4947c62f
9 changed files with 567 additions and 6 deletions
|
@ -46,7 +46,7 @@ func (storage *Storage) RegisterClient(
|
|||
return id, nil
|
||||
}
|
||||
|
||||
func (storage *Storage) GetClientByID(
|
||||
func (storage *Storage) GetClient(
|
||||
ctx context.Context,
|
||||
id string,
|
||||
) (*rfc7591v1.ClientMetadata, error) {
|
||||
|
@ -85,3 +85,24 @@ func (storage *Storage) CreateAuthorizationRequest(
|
|||
}
|
||||
return id, nil
|
||||
}
|
||||
|
||||
func (storage *Storage) GetAuthorizationRequest(
|
||||
ctx context.Context,
|
||||
id string,
|
||||
) (*oauth21proto.AuthorizationRequest, error) {
|
||||
v := new(oauth21proto.AuthorizationRequest)
|
||||
rec, err := storage.client.Get(ctx, &databroker.GetRequest{
|
||||
Type: protoutil.GetTypeURL(v),
|
||||
Id: id,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get authorization request by ID: %w", err)
|
||||
}
|
||||
|
||||
err = anypb.UnmarshalTo(rec.Record.Data, v, proto.UnmarshalOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to unmarshal authorization request: %w", err)
|
||||
}
|
||||
|
||||
return v, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue