Skip to content

Commit

Permalink
chore: remove deprected code from example
Browse files Browse the repository at this point in the history
  • Loading branch information
shaj13 committed Mar 2, 2023
1 parent 87d98d8 commit ed383ca
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 21 deletions.
3 changes: 0 additions & 3 deletions _examples/basic/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ func getBookAuthor(w http.ResponseWriter, r *http.Request) {
func setupGoGuardian() {
cacheObj = libcache.FIFO.New(0)
cacheObj.SetTTL(time.Minute * 5)
cacheObj.RegisterOnExpired(func(key, _ interface{}) {
cacheObj.Peek(key)
})
strategy = basic.NewCached(validateUser, cacheObj)
}

Expand Down
3 changes: 0 additions & 3 deletions _examples/digest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ func init() {
var c libcache.Cache
c = libcache.FIFO.New(10)
c.SetTTL(time.Minute * 3)
c.RegisterOnExpired(func(key, _ interface{}) {
c.Delete(key)
})
strategy = digest.New(validateUser, c)
}

Expand Down
3 changes: 0 additions & 3 deletions _examples/jwt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ func setupGoGuardian() {
}
cache := libcache.FIFO.New(0)
cache.SetTTL(time.Minute * 5)
cache.RegisterOnExpired(func(key, _ interface{}) {
cache.Peek(key)
})
basicStrategy := basic.NewCached(validateUser, cache)
jwtStrategy := jwt.New(cache, keeper)
strategy = union.New(jwtStrategy, basicStrategy)
Expand Down
3 changes: 0 additions & 3 deletions _examples/kubernetes/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ func getBookAuthor(w http.ResponseWriter, r *http.Request) {
func setupGoGuardian() {
cacheObj = libcache.FIFO.New(0)
cacheObj.SetTTL(time.Minute * 5)
cacheObj.RegisterOnExpired(func(key, _ interface{}) {
cacheObj.Peek(key)
})
strategy = kubernetes.New(cacheObj)
}

Expand Down
3 changes: 0 additions & 3 deletions _examples/ldap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ func setupGoGuardian() {
}
cacheObj = libcache.FIFO.New(0)
cacheObj.SetTTL(time.Minute * 5)
cacheObj.RegisterOnExpired(func(key, _ interface{}) {
cacheObj.Peek(key)
})
strategy = ldap.NewCached(cfg, cacheObj)
}

Expand Down
3 changes: 0 additions & 3 deletions _examples/oauth2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ func getBookAuthor(w http.ResponseWriter, r *http.Request) {
func setupGoGuardian() {
cache := libcache.FIFO.New(0)
cache.SetTTL(time.Minute * 5)
cache.RegisterOnExpired(func(key, _ interface{}) {
cache.Peek(key)
})
parser := token.QueryParser("token")
opt := token.SetParser(parser)
// Use jwt.SetClaimResolver()
Expand Down
3 changes: 0 additions & 3 deletions _examples/token/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ func getBookAuthor(w http.ResponseWriter, r *http.Request) {
func setupGoGuardian() {
cacheObj = libcache.FIFO.New(0)
cacheObj.SetTTL(time.Minute * 5)
cacheObj.RegisterOnExpired(func(key, _ interface{}) {
cacheObj.Peek(key)
})
basicStrategy := basic.NewCached(validateUser, cacheObj)
tokenStrategy = token.New(token.NoOpAuthenticate, cacheObj)
strategy = union.New(tokenStrategy, basicStrategy)
Expand Down

0 comments on commit ed383ca

Please sign in to comment.