Skip to content

Commit d60a966

Browse files
committed
add revocation by id; api 0.7
1 parent c9e88a2 commit d60a966

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module github.com/oidc-mytoken/lib
22

33
go 1.13
44

5-
require github.com/oidc-mytoken/api v0.6.0
5+
require github.com/oidc-mytoken/api v0.7.0

go.sum

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
21
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3-
github.com/oidc-mytoken/api v0.6.0 h1:J+/gNLB7bIh5Cf8HGtGIGak/AILdp5DLPvXPsUGApck=
4-
github.com/oidc-mytoken/api v0.6.0/go.mod h1:ljMG5L38yap1K+zvYBjsYXy2XYw6Vy0A4wACnnTHaCQ=
2+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4+
github.com/oidc-mytoken/api v0.7.0 h1:SXwIoWmmyqnoVp4DS9/CB3qV8ONqWx5OHVo7aggb1aw=
5+
github.com/oidc-mytoken/api v0.7.0/go.mod h1:DBIlUbaIgGlf607VZx8zFC97VR3WNN0kaMVO1AqyTdE=
56
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
67
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
78
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
8-
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
9+
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
910
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
11+
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
12+
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
1013
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
1114
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
12-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
1315
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
16+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
17+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

revoke.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,15 @@ func (r RevocationEndpoint) Revoke(mytoken, oidcIssuer string, recursive bool) e
3030
}
3131
return r.DoHTTPRequest("POST", req, nil)
3232
}
33+
34+
// RevokeID revokes the mytoken with the passed revocation id; using the passed mytoken as authorization; if
35+
// recursive is true also all subtokens (and their subtokens...) are revoked.
36+
func (r RevocationEndpoint) RevokeID(revocationID, mytoken, oidcIssuer string, recursive bool) error {
37+
req := api.RevocationRequest{
38+
RevocationID: revocationID,
39+
Token: mytoken,
40+
Recursive: recursive,
41+
OIDCIssuer: oidcIssuer,
42+
}
43+
return r.DoHTTPRequest("POST", req, nil)
44+
}

tokeninfo.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (info TokeninfoEndpoint) History(mytoken *string) (api.EventHistory, error)
5858
return resp.EventHistory, nil
5959
}
6060

61-
// APISubtokens returns a api.TokeninfoTreeResponse listing metadata about the passed mytoken and its children (
61+
// APISubtokens returns an api.TokeninfoTreeResponse listing metadata about the passed mytoken and its children (
6262
// recursively)
6363
// If the used mytoken changes (due to token rotation), the new mytoken is included in the api.TokeninfoTreeResponse
6464
func (info TokeninfoEndpoint) APISubtokens(mytoken string) (resp api.TokeninfoSubtokensResponse, err error) {
@@ -70,7 +70,7 @@ func (info TokeninfoEndpoint) APISubtokens(mytoken string) (resp api.TokeninfoSu
7070
return
7171
}
7272

73-
// Subtokens returns a api.MytokenEntryTree listing metadata about the passed mytoken and its children (
73+
// Subtokens returns an api.MytokenEntryTree listing metadata about the passed mytoken and its children (
7474
// recursively)
7575
// If the used mytoken changes (due to token rotation), the passed variable is updated accordingly.
7676
func (info TokeninfoEndpoint) Subtokens(mytoken *string) (*api.MytokenEntryTree, error) {
@@ -84,7 +84,7 @@ func (info TokeninfoEndpoint) Subtokens(mytoken *string) (*api.MytokenEntryTree,
8484
return &resp.Tokens, nil
8585
}
8686

87-
// APIListMytokens returns a api.TokeninfoListResponse listing metadata about all the user's mytoken and their
87+
// APIListMytokens returns an api.TokeninfoListResponse listing metadata about all the user's mytoken and their
8888
// children (recursively)
8989
// If the used mytoken changes (due to token rotation), the new mytoken is included in the api.TokeninfoListResponse
9090
func (info TokeninfoEndpoint) APIListMytokens(mytoken string) (resp api.TokeninfoListResponse, err error) {

0 commit comments

Comments
 (0)