Skip to content

Commit

Permalink
Fixes for custom tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenz committed Feb 19, 2023
1 parent 6d7a52f commit b699b9b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
54 changes: 28 additions & 26 deletions deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,34 @@ spec:
type: string
customTokenFields:
type: object
properties:
length:
type: number
description: |
Length of the token which should be generated. This is the number of bytes
for the base64, hex and raw encodings and the number of characters for the
characterset encoding. It is ignored for the uuid encoding.
encoding:
type: string
enum: [ base64, base64url, hex, upperhex, characterset, raw, uuid ]
description: |
Encoding to use
characterSet:
type: string
description: |
All characters (unicode code points) in this string can be used to
make up the token. Only used in the characterset encoding.
prefix:
type: string
description: |
Prefix to put before the generated token.
suffix:
type: string
description: |
Suffix to put after the generated token.
required: ["encoding"]
additionalProperties:
type: object
properties:
length:
type: number
description: |
Length of the token which should be generated. This is the number of bytes
for the base64, hex and raw encodings and the number of characters for the
characterset encoding. It is ignored for the uuid encoding.
encoding:
type: string
enum: [ base64, base64url, hex, upperhex, characterset, raw, uuid ]
description: |
Encoding to use
characterSet:
type: string
description: |
All characters (unicode code points) in this string can be used to
make up the token. Only used in the characterset encoding.
prefix:
type: string
description: |
Prefix to put before the generated token.
suffix:
type: string
description: |
Suffix to put after the generated token.
required: ["encoding"]
fixedFields:
type: object
description: These fields are copied as-is into the secret
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ func (c *controller) reconcileSC(key string) error {
}
}
for field, spec := range sc.Spec.CustomTokenFields {
if !customTokenValid(&spec, string(newData[field])) {
if !customTokenValid(&spec, string(oldSecret.Data[field])) {
token, err := makeCustomToken(&spec)
newData[field] = []byte(token)
if err != nil {
Expand Down

0 comments on commit b699b9b

Please sign in to comment.