Skip to content

Commit

Permalink
Add audit log to logout all sessions (#62)
Browse files Browse the repository at this point in the history
## Description

- [x] Adding audit log to logout all sessions
- [x] Updating variable name 

AB#1437807

## Motivation and Context

Audit log for logout all sessions

## How Has This Been Tested?

Locally integrated with PICS. Used webhook to receive the audit entry.

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [x] My change requires a change to the documentation or CHANGELOG.
- [x] I have updated the documentation/CHANGELOG accordingly.
- [x] I have created a feature (non-master) branch for my PR.
  • Loading branch information
andersonvcv authored Jan 8, 2025
2 parents 673256f + b50dc01 commit 1a4f3ca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion oauthproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func (p *OAuthProxy) buildProxySubrouter(s *mux.Router) {
p.SignOut(w, r, false)
},
))
s.Path(picsSignOutAllDevicesPath).Handler(p.sessionChain.ThenFunc(
s.Path(picsSignOutAllSessionsPath).Handler(p.sessionChain.ThenFunc(
func(w http.ResponseWriter, r *http.Request) {
p.SignOut(w, r, true)
},
Expand Down Expand Up @@ -813,6 +813,8 @@ func (p *OAuthProxy) backendLogout(rw http.ResponseWriter, req *http.Request, si
if resp.StatusCode() != 200 {
logger.Errorf("error while calling backend logout url, returned error code %v", resp.StatusCode())
}

p.picsAuditClient.CreateSuccessfulLogoutAuditEntry(session, req.RequestURI, req.Header.Get("edisp-org-id"))
} else {
if providerData.BackendLogoutURL == "" {
return
Expand Down
2 changes: 1 addition & 1 deletion pics_oauthproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

const (
picsSignOutAllDevicesPath = "/sign_out_all_sessions"
picsSignOutAllSessionsPath = "/sign_out_all_sessions"
)

func PicsSignOutAllSessions(backendLogoutAllSessionsURL string, introspectClaims string, accessToken string) (resp requests.Result, err error) {
Expand Down
1 change: 1 addition & 0 deletions pkg/pics/audit/audit_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func (c *Client) CreateSuccessfulLogoutAuditEntry(ss *sessions.SessionState, app
System: "http://hl7.org/fhir/ValueSet/audit-event-type", Version: "1", Code: "110123", Display: "Logout", UserSelected: "All Sessions"}
c.createAuditEntry(ss, appURL, tenantID, "0", "Success", &coding)
}

func (c *Client) createAuditEntry(ss *sessions.SessionState, appURL string, tenantID string, outcomeCode string, outcomeDesc string, coding *Coding) {
if !c.enabled {
return
Expand Down

0 comments on commit 1a4f3ca

Please sign in to comment.