Skip to content

Commit

Permalink
Merge 41fe64c into b5187a8
Browse files Browse the repository at this point in the history
  • Loading branch information
tbuchaillot committed Sep 11, 2020
2 parents b5187a8 + 41fe64c commit 08438e2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gateway/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ func handleGetDetail(sessionKey, apiID string, byHash bool) (interface{}, int) {
sessionManager = spec.SessionManager
}

var session user.SessionState
session := user.SessionState{Mutex: &sync.RWMutex{}}
var ok bool
session, ok = sessionManager.SessionDetail(sessionKey, byHash)

Expand Down
5 changes: 2 additions & 3 deletions gateway/auth_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (b *DefaultAuthorisationManager) Init(store storage.Handler) {
// KeyAuthorised checks if key exists and can be read into a user.SessionState object
func (b *DefaultAuthorisationManager) KeyAuthorised(keyName string) (user.SessionState, bool) {
jsonKeyVal, err := b.store.GetKey(keyName)
var newSession user.SessionState
newSession := user.SessionState{Mutex: &sync.RWMutex{}}
if err != nil {
log.WithFields(logrus.Fields{
"prefix": "auth-mgr",
Expand Down Expand Up @@ -280,8 +280,7 @@ func (b *DefaultSessionManager) RemoveSession(keyName string, hashed bool) bool
func (b *DefaultSessionManager) SessionDetail(keyName string, hashed bool) (user.SessionState, bool) {
var jsonKeyVal string
var err error
var session user.SessionState

session := user.SessionState{Mutex: &sync.RWMutex{}}
// get session by key
if hashed {
jsonKeyVal, err = b.store.GetRawKey(b.store.GetKeyPrefix() + keyName)
Expand Down
3 changes: 2 additions & 1 deletion gateway/mw_http_signature_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"net/url"
"strconv"
"strings"
"sync"
"text/scanner"
"time"

Expand Down Expand Up @@ -96,7 +97,7 @@ func (hm *HTTPSignatureValidationMiddleware) ProcessRequest(w http.ResponseWrite

var secret string
var rsaKey *rsa.PublicKey
var session user.SessionState
session := user.SessionState{Mutex: &sync.RWMutex{}}

if strings.HasPrefix(fieldValues.Algorthm, "rsa") {
var certificateId string
Expand Down
2 changes: 1 addition & 1 deletion gateway/oauth_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func (o *OAuthManager) HandleAccess(r *http.Request) *osin.Response {

if ar := o.OsinServer.HandleAccessRequest(resp, r); ar != nil {

var session *user.SessionState
session := &user.SessionState{Mutex: &sync.RWMutex{}}
if ar.Type == osin.PASSWORD {
username = r.Form.Get("username")
password := r.Form.Get("password")
Expand Down

0 comments on commit 08438e2

Please sign in to comment.