Add audit log to logout all sessions (#62)

## 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.
This commit is contained in:
Anderson Valério 2025-01-08 11:08:51 -03:00 committed by GitHub
commit 1a4f3cae73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 2 deletions

View File

@ -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)
},
@ -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

View File

@ -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) {

View File

@ -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