mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-31 15:29:48 +02:00
authenticate: save oauth2 tokens to cache (#698)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
parent
ef399380b7
commit
666fd6aa35
31 changed files with 1127 additions and 1061 deletions
22
internal/hashutil/hashutil.go
Normal file
22
internal/hashutil/hashutil.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Package hashutil provides NON-CRYPTOGRAPHIC utility functions for hashing
|
||||
package hashutil
|
||||
|
||||
import (
|
||||
"github.com/cespare/xxhash/v2"
|
||||
"github.com/mitchellh/hashstructure"
|
||||
)
|
||||
|
||||
// Hash returns the xxhash value of an arbitrary value or struct. Returns 0
|
||||
// on error. NOT SUITABLE FOR CRYTOGRAPHIC HASHING.
|
||||
//
|
||||
// http://cyan4973.github.io/xxHash/
|
||||
func Hash(v interface{}) uint64 {
|
||||
opts := &hashstructure.HashOptions{
|
||||
Hasher: xxhash.New(),
|
||||
}
|
||||
hash, err := hashstructure.Hash(v, opts)
|
||||
if err != nil {
|
||||
hash = 0
|
||||
}
|
||||
return hash
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue