Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
loeffel-io committed Sep 28, 2021
1 parent c942c79 commit 17593c2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions authenticator/authenticator.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Authenticator interface {
SetMiddleware(middleware *jwt.GinJWTMiddleware)
GetMiddleware() *jwt.GinJWTMiddleware
CreateMiddleware() error
AuthMiddleware() gin.HandlerFunc
GetSecurity() makeless_go_security.Security
GetRealm() string
GetKey() []byte
Expand Down
5 changes: 5 additions & 0 deletions authenticator/basic/authenticator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package makeless_go_authenticator_basic

import (
"github.com/appleboy/gin-jwt/v2"
"github.com/gin-gonic/gin"
"github.com/makeless/makeless-go/security"
"net/http"
"sync"
Expand Down Expand Up @@ -36,6 +37,10 @@ func (authenticator *Authenticator) GetMiddleware() *jwt.GinJWTMiddleware {
return authenticator.Middlware
}

func (authenticator *Authenticator) AuthMiddleware() gin.HandlerFunc {
return authenticator.GetMiddleware().MiddlewareFunc()
}

func (authenticator *Authenticator) GetSecurity() makeless_go_security.Security {
authenticator.RLock()
defer authenticator.RUnlock()
Expand Down
1 change: 1 addition & 0 deletions http/basic/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Router struct {
}

func (router *Router) Init(http makeless_go_http.Http) error {
gin.SetMode(http.GetMode())
r := gin.Default()
r.Use(http.CorsMiddleware(http.GetOrigins(), http.GetOriginsFunc(), http.GetHeaders()))

Expand Down

0 comments on commit 17593c2

Please sign in to comment.