mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-03 19:32:48 +02:00
authorize: add support for service accounts (#1374)
This commit is contained in:
parent
eaf0dd4e67
commit
0a6796ff71
8 changed files with 236 additions and 51 deletions
|
@ -50,3 +50,17 @@ func Set(ctx context.Context, client databroker.DataBrokerServiceClient, u *User
|
|||
}
|
||||
return res.GetRecord(), nil
|
||||
}
|
||||
|
||||
// SetServiceAccount sets a service account in the databroker.
|
||||
func SetServiceAccount(ctx context.Context, client databroker.DataBrokerServiceClient, sa *ServiceAccount) (*databroker.Record, error) {
|
||||
any, _ := anypb.New(sa)
|
||||
res, err := client.Set(ctx, &databroker.SetRequest{
|
||||
Type: any.GetTypeUrl(),
|
||||
Id: sa.GetId(),
|
||||
Data: any,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error setting service account in databroker: %w", err)
|
||||
}
|
||||
return res.GetRecord(), nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue