Skip to content

Commit

Permalink
u
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Jan 14, 2020
1 parent b0dd2ad commit 52fe307
Show file tree
Hide file tree
Showing 11 changed files with 196 additions and 211 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ install:
.PHONY: init
init:
GO111MODULE=on go get .
GO111MODULE=on go install github.com/ory/go-acc
GO111MODULE=on go install github.com/ory/go-acc
4 changes: 4 additions & 0 deletions client/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ func (h *Handler) List(w http.ResponseWriter, r *http.Request, ps httprouter.Par

pagination.Header(w, r.URL, n, limit, offset)

if c == nil {
c = []Client{}
}

h.r.Writer().Write(w, r, c)
}

Expand Down
17 changes: 13 additions & 4 deletions consent/manager_memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ import (
"github.com/pkg/errors"

"github.com/ory/fosite"
"github.com/ory/hydra/x"
"github.com/ory/x/pagination"

"github.com/ory/hydra/x"
)

type MemoryManager struct {
Expand Down Expand Up @@ -463,10 +464,16 @@ func (m *MemoryManager) ListUserAuthenticatedClientsWithFrontChannelLogout(ctx c
m.m["consentRequests"].RLock()
defer m.m["consentRequests"].RUnlock()

preventDupes := make(map[string]bool)
var rs []client.Client
for _, cr := range m.consentRequests {
if cr.Subject == subject && len(cr.Client.FrontChannelLogoutURI) > 0 && cr.LoginSessionID == sid {
if cr.Subject == subject &&
len(cr.Client.FrontChannelLogoutURI) > 0 &&
cr.LoginSessionID == sid &&
!preventDupes[cr.Client.GetID()] {

rs = append(rs, *cr.Client)
preventDupes[cr.Client.GetID()] = true
}
}

Expand All @@ -478,10 +485,12 @@ func (m *MemoryManager) ListUserAuthenticatedClientsWithBackChannelLogout(ctx co
defer m.m["consentRequests"].RUnlock()

clientsMap := make(map[string]bool)

var rs []client.Client
for _, cr := range m.consentRequests {
if (cr.Subject == subject) && cr.LoginSessionID == sid && (len(cr.Client.BackChannelLogoutURI) > 0) && !(clientsMap[cr.Client.GetID()]) {
if cr.Subject == subject &&
cr.LoginSessionID == sid &&
len(cr.Client.BackChannelLogoutURI) > 0 &&
!(clientsMap[cr.Client.GetID()]) {
rs = append(rs, *cr.Client)
clientsMap[cr.Client.GetID()] = true
}
Expand Down

0 comments on commit 52fe307

Please sign in to comment.