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 {
128128
129129 // Parse the token. Load the key from command line option
130130 token , err := jwt .Parse (string (tokData ), func (t * jwt.Token ) (interface {}, error ) {
131+ if isNone () {
132+ return jwt .UnsafeAllowNoneSignatureType , nil
133+ }
131134 data , err := loadData (* flagKey )
132135 if err != nil {
133136 return nil , err
@@ -192,9 +195,13 @@ func signToken() error {
192195
193196 // get the key
194197 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+ }
198205 }
199206
200207 // get the signing alg
@@ -296,6 +303,10 @@ func isEd() bool {
296303 return * flagAlg == "EdDSA"
297304}
298305
306+ func isNone () bool {
307+ return * flagAlg == "none"
308+ }
309+
299310type ArgList map [string ]string
300311
301312func (l ArgList ) String () string {
You can’t perform that action at this time.
0 commit comments