Skip to content

Commit a95f6dc

Browse files
committed
minimal roundtripping change
1 parent 6130e6b commit a95f6dc

File tree

2 files changed

+64
-14
lines changed

2 files changed

+64
-14
lines changed

pkg/oauth/apis/oauth/types.go

+18
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ type OAuthAccessToken struct {
3535

3636
// RefreshToken is the value by which this token can be renewed. Can be blank.
3737
RefreshToken string
38+
39+
// InactivityTimeoutSeconds is the value in seconds, from the
40+
// CreationTimestamp, after which this token can no longer be used.
41+
// The value is automatically incremented when the token is used.
42+
InactivityTimeoutSeconds int32
3843
}
3944

4045
// +genclient
@@ -107,6 +112,19 @@ type OAuthClient struct {
107112
// AccessTokenMaxAgeSeconds overrides the default access token max age for tokens granted to this client.
108113
// 0 means no expiration.
109114
AccessTokenMaxAgeSeconds *int32
115+
116+
// AccessTokenInactivityTimeoutSeconds overrides the default token
117+
// inactivity timeout for tokens granted to this client.
118+
// The value represents the maximum amount of time that can occur between
119+
// consecutive uses of the token. Tokens become invalid if they are not
120+
// used within this temporal window. The user will need to acquire a new
121+
// token to regain access once a token times out.
122+
// This value needs to be set only if the default set in configuration is
123+
// not appropriate for this client. Valid values are:
124+
// - 0: Tokens for this client never time out
125+
// - X: Tokens time out if there is no activity for X seconds
126+
// The current minimum allowed value for X is 300 (5 minutes)
127+
AccessTokenInactivityTimeoutSeconds *int32
110128
}
111129

112130
type GrantHandlerType string

pkg/oauth/apis/oauth/v1/zz_generated.conversion.go

+46-14
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,10 @@ func autoConvert_v1_OAuthAccessToken_To_oauth_OAuthAccessToken(in *v1.OAuthAcces
8181
out.UserUID = in.UserUID
8282
out.AuthorizeToken = in.AuthorizeToken
8383
out.RefreshToken = in.RefreshToken
84+
// WARNING: in.InactivityTimeoutSeconds requires manual conversion: does not exist in peer-type
8485
return nil
8586
}
8687

87-
// Convert_v1_OAuthAccessToken_To_oauth_OAuthAccessToken is an autogenerated conversion function.
88-
func Convert_v1_OAuthAccessToken_To_oauth_OAuthAccessToken(in *v1.OAuthAccessToken, out *oauth.OAuthAccessToken, s conversion.Scope) error {
89-
return autoConvert_v1_OAuthAccessToken_To_oauth_OAuthAccessToken(in, out, s)
90-
}
91-
9288
func autoConvert_oauth_OAuthAccessToken_To_v1_OAuthAccessToken(in *oauth.OAuthAccessToken, out *v1.OAuthAccessToken, s conversion.Scope) error {
9389
out.ObjectMeta = in.ObjectMeta
9490
out.ClientName = in.ClientName
@@ -109,7 +105,17 @@ func Convert_oauth_OAuthAccessToken_To_v1_OAuthAccessToken(in *oauth.OAuthAccess
109105

110106
func autoConvert_v1_OAuthAccessTokenList_To_oauth_OAuthAccessTokenList(in *v1.OAuthAccessTokenList, out *oauth.OAuthAccessTokenList, s conversion.Scope) error {
111107
out.ListMeta = in.ListMeta
112-
out.Items = *(*[]oauth.OAuthAccessToken)(unsafe.Pointer(&in.Items))
108+
if in.Items != nil {
109+
in, out := &in.Items, &out.Items
110+
*out = make([]oauth.OAuthAccessToken, len(*in))
111+
for i := range *in {
112+
if err := Convert_v1_OAuthAccessToken_To_oauth_OAuthAccessToken(&(*in)[i], &(*out)[i], s); err != nil {
113+
return err
114+
}
115+
}
116+
} else {
117+
out.Items = nil
118+
}
113119
return nil
114120
}
115121

@@ -120,7 +126,17 @@ func Convert_v1_OAuthAccessTokenList_To_oauth_OAuthAccessTokenList(in *v1.OAuthA
120126

121127
func autoConvert_oauth_OAuthAccessTokenList_To_v1_OAuthAccessTokenList(in *oauth.OAuthAccessTokenList, out *v1.OAuthAccessTokenList, s conversion.Scope) error {
122128
out.ListMeta = in.ListMeta
123-
out.Items = *(*[]v1.OAuthAccessToken)(unsafe.Pointer(&in.Items))
129+
if in.Items != nil {
130+
in, out := &in.Items, &out.Items
131+
*out = make([]v1.OAuthAccessToken, len(*in))
132+
for i := range *in {
133+
if err := Convert_oauth_OAuthAccessToken_To_v1_OAuthAccessToken(&(*in)[i], &(*out)[i], s); err != nil {
134+
return err
135+
}
136+
}
137+
} else {
138+
out.Items = nil
139+
}
124140
return nil
125141
}
126142

@@ -198,14 +214,10 @@ func autoConvert_v1_OAuthClient_To_oauth_OAuthClient(in *v1.OAuthClient, out *oa
198214
out.GrantMethod = oauth.GrantHandlerType(in.GrantMethod)
199215
out.ScopeRestrictions = *(*[]oauth.ScopeRestriction)(unsafe.Pointer(&in.ScopeRestrictions))
200216
out.AccessTokenMaxAgeSeconds = (*int32)(unsafe.Pointer(in.AccessTokenMaxAgeSeconds))
217+
// WARNING: in.AccessTokenInactivityTimeoutSeconds requires manual conversion: does not exist in peer-type
201218
return nil
202219
}
203220

204-
// Convert_v1_OAuthClient_To_oauth_OAuthClient is an autogenerated conversion function.
205-
func Convert_v1_OAuthClient_To_oauth_OAuthClient(in *v1.OAuthClient, out *oauth.OAuthClient, s conversion.Scope) error {
206-
return autoConvert_v1_OAuthClient_To_oauth_OAuthClient(in, out, s)
207-
}
208-
209221
func autoConvert_oauth_OAuthClient_To_v1_OAuthClient(in *oauth.OAuthClient, out *v1.OAuthClient, s conversion.Scope) error {
210222
out.ObjectMeta = in.ObjectMeta
211223
out.Secret = in.Secret
@@ -275,7 +287,17 @@ func Convert_oauth_OAuthClientAuthorizationList_To_v1_OAuthClientAuthorizationLi
275287

276288
func autoConvert_v1_OAuthClientList_To_oauth_OAuthClientList(in *v1.OAuthClientList, out *oauth.OAuthClientList, s conversion.Scope) error {
277289
out.ListMeta = in.ListMeta
278-
out.Items = *(*[]oauth.OAuthClient)(unsafe.Pointer(&in.Items))
290+
if in.Items != nil {
291+
in, out := &in.Items, &out.Items
292+
*out = make([]oauth.OAuthClient, len(*in))
293+
for i := range *in {
294+
if err := Convert_v1_OAuthClient_To_oauth_OAuthClient(&(*in)[i], &(*out)[i], s); err != nil {
295+
return err
296+
}
297+
}
298+
} else {
299+
out.Items = nil
300+
}
279301
return nil
280302
}
281303

@@ -286,7 +308,17 @@ func Convert_v1_OAuthClientList_To_oauth_OAuthClientList(in *v1.OAuthClientList,
286308

287309
func autoConvert_oauth_OAuthClientList_To_v1_OAuthClientList(in *oauth.OAuthClientList, out *v1.OAuthClientList, s conversion.Scope) error {
288310
out.ListMeta = in.ListMeta
289-
out.Items = *(*[]v1.OAuthClient)(unsafe.Pointer(&in.Items))
311+
if in.Items != nil {
312+
in, out := &in.Items, &out.Items
313+
*out = make([]v1.OAuthClient, len(*in))
314+
for i := range *in {
315+
if err := Convert_oauth_OAuthClient_To_v1_OAuthClient(&(*in)[i], &(*out)[i], s); err != nil {
316+
return err
317+
}
318+
}
319+
} else {
320+
out.Items = nil
321+
}
290322
return nil
291323
}
292324

0 commit comments

Comments
 (0)