major refactoring
This commit is contained in:
parent
826d035d3e
commit
f2d57c6e18
4 changed files with 87 additions and 89 deletions
6
token.go
6
token.go
|
|
@ -14,7 +14,7 @@ type Token struct {
|
|||
data string
|
||||
signature string
|
||||
rawSignature []byte
|
||||
header map[string]interface{}
|
||||
header Claims
|
||||
Claims Claims
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ func (t *Token) RawSig() []byte {
|
|||
}
|
||||
|
||||
// Header returns the Tokens header
|
||||
func (t *Token) Header() map[string]interface{} {
|
||||
func (t *Token) Header() Claims {
|
||||
return t.header
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ func NewToken(claims Claims, hash Hash) *Token {
|
|||
hash = NewHS256()
|
||||
}
|
||||
return &Token{
|
||||
header: map[string]interface{}{
|
||||
header: Claims{
|
||||
"alg": hash.Alg(),
|
||||
"typ": typ,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue