Skip to content

Commit

Permalink
feat!: Abilitiy to set JWT audience claim (#204)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: JWTs can now be created with a fix audience value. Needed for OpenZiti integratin

Signed-off-by: Bryon Nevis <[email protected]>
  • Loading branch information
bnevis-i authored Apr 13, 2023
1 parent 9437f06 commit f3306c0
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 22 deletions.
3 changes: 2 additions & 1 deletion internal/pkg/vault/management.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,14 +562,15 @@ func (c *Client) CreateNamedIdentityKey(token string, keyName string, algorithm
return err
}

func (c *Client) CreateOrUpdateIdentityRole(token string, roleName string, keyName string, template string, jwtTTL string) error {
func (c *Client) CreateOrUpdateIdentityRole(token string, roleName string, keyName string, template string, audience string, jwtTTL string) error {

var templatePointer *string = nil
if template != "" {
templatePointer = &template
}

request := CreateOrUpdateIdentityRoleRequest{
ClientID: audience,
Key: keyName,
Template: templatePointer, // optional field
TokenTTL: jwtTTL,
Expand Down
1 change: 1 addition & 0 deletions internal/pkg/vault/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ type CreateNamedKeyRequest struct {

// CreateOrUpdateIdentityRoleRequest is the request to POST /v1/identity/oidc/role/:name
type CreateOrUpdateIdentityRoleRequest struct {
ClientID string `json:"client_id,omitempty"`
Key string `json:"key"`
Template *string `json:"template,omitempty"`
TokenTTL string `json:"ttl"`
Expand Down
2 changes: 1 addition & 1 deletion secrets/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ type SecretStoreClient interface {
InternalServiceLogin(token string, authEngine string, username string, password string) (map[string]interface{}, error)
CheckIdentityKeyExists(token string, keyName string) (bool, error)
CreateNamedIdentityKey(token string, keyName string, algorithm string) error
CreateOrUpdateIdentityRole(token string, roleName string, keyName string, template string, jwtTTL string) error
CreateOrUpdateIdentityRole(token string, roleName string, keyName string, template string, audience string, jwtTTL string) error
}
82 changes: 62 additions & 20 deletions secrets/mocks/SecretStoreClient.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f3306c0

Please sign in to comment.