mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-27 14:48:45 +00:00
feat: add activity logs on user actions with authentication, resource… (#6748)
* feat: add activity logs on user actions with authentication, resourceAPI and sessionAPI * feat: add activity logs on user actions with authentication, resourceAPI and sessionAPI * feat: add activity logs on user actions with authentication, resourceAPI and sessionAPI * feat: add activity logs on user actions with authentication, resourceAPI and sessionAPI * feat: add activity logs on user actions with authentication, resourceAPI and sessionAPI * fix: add unit tests to info package for context changes * fix: add activity_interceptor.go suggestion Co-authored-by: Tim Möhlmann <[email protected]> * fix: refactoring and fixes through PR review * fix: add auth service to lists of resourceAPIs --------- Co-authored-by: Tim Möhlmann <[email protected]> Co-authored-by: Fabi <[email protected]>
This commit is contained in:
co-authored by
Tim Möhlmann
Fabi
parent
385a55bd21
commit
48ae5d58ac
@@ -0,0 +1,43 @@
|
||||
package info
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type activityInfoKey struct{}
|
||||
|
||||
type ActivityInfo struct {
|
||||
Method string
|
||||
Path string
|
||||
RequestMethod string
|
||||
}
|
||||
|
||||
func (a *ActivityInfo) IntoContext(ctx context.Context) context.Context {
|
||||
return context.WithValue(ctx, activityInfoKey{}, a)
|
||||
}
|
||||
|
||||
func ActivityInfoFromContext(ctx context.Context) *ActivityInfo {
|
||||
m := ctx.Value(activityInfoKey{})
|
||||
if m == nil {
|
||||
return &ActivityInfo{}
|
||||
}
|
||||
ai, ok := m.(*ActivityInfo)
|
||||
if !ok {
|
||||
return &ActivityInfo{}
|
||||
}
|
||||
return ai
|
||||
}
|
||||
|
||||
func (a *ActivityInfo) SetMethod(method string) *ActivityInfo {
|
||||
a.Method = method
|
||||
return a
|
||||
}
|
||||
func (a *ActivityInfo) SetPath(path string) *ActivityInfo {
|
||||
a.Path = path
|
||||
return a
|
||||
}
|
||||
|
||||
func (a *ActivityInfo) SetRequestMethod(method string) *ActivityInfo {
|
||||
a.RequestMethod = method
|
||||
return a
|
||||
}
|
||||
Reference in New Issue
Block a user