File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,9 @@ func verifyToken() error {
128
128
129
129
// Parse the token. Load the key from command line option
130
130
token , err := jwt .Parse (string (tokData ), func (t * jwt.Token ) (interface {}, error ) {
131
+ if isNone () {
132
+ return jwt .UnsafeAllowNoneSignatureType , nil
133
+ }
131
134
data , err := loadData (* flagKey )
132
135
if err != nil {
133
136
return nil , err
@@ -192,9 +195,13 @@ func signToken() error {
192
195
193
196
// get the key
194
197
var key interface {}
195
- key , err = loadData (* flagKey )
196
- if err != nil {
197
- return fmt .Errorf ("couldn't read key: %w" , err )
198
+ if isNone () {
199
+ key = jwt .UnsafeAllowNoneSignatureType
200
+ } else {
201
+ key , err = loadData (* flagKey )
202
+ if err != nil {
203
+ return fmt .Errorf ("couldn't read key: %w" , err )
204
+ }
198
205
}
199
206
200
207
// get the signing alg
@@ -296,6 +303,10 @@ func isEd() bool {
296
303
return * flagAlg == "EdDSA"
297
304
}
298
305
306
+ func isNone () bool {
307
+ return * flagAlg == "none"
308
+ }
309
+
299
310
type ArgList map [string ]string
300
311
301
312
func (l ArgList ) String () string {
You can’t perform that action at this time.
0 commit comments