Skip to content

Commit

Permalink
Change GetMap Function
Browse files Browse the repository at this point in the history
  • Loading branch information
kristinapathak committed Sep 16, 2019
1 parent 9f18d3f commit 20c5c52
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions jws.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package bascule

import (
"encoding/json"
"errors"

jwt "github.com/dgrijalva/jwt-go"
Expand Down Expand Up @@ -69,14 +68,16 @@ func (c *ClaimsWithLeeway) Valid() error {

// GetMap returns a map of string to interfaces of the values in the ClaimsWithLeeway
func (c *ClaimsWithLeeway) GetMap() (map[string]interface{}, error) {
var finalMap map[string]interface{}
inrec, err := json.Marshal(c)
if err != nil {
return nil, err
}
err = json.Unmarshal(inrec, &finalMap)
if err != nil {
return nil, err
}
return finalMap, nil
// for StandardClaims, which don't work with the []string aud values that we use
// var finalMap map[string]interface{}
// inrec, err := json.Marshal(c)
// if err != nil {
// return nil, err
// }
// err = json.Unmarshal(inrec, &finalMap)
// if err != nil {
// return nil, err
// }
// return finalMap, nil
return c.MapClaims, nil
}

0 comments on commit 20c5c52

Please sign in to comment.