File tree 3 files changed +21
-9
lines changed
com/amazon/dlic/auth/http/jwt
3 files changed +21
-9
lines changed Original file line number Diff line number Diff line change 15
15
import java .security .AccessController ;
16
16
import java .security .PrivilegedAction ;
17
17
import java .util .Collection ;
18
+ import java .util .Collections ;
18
19
import java .util .Map ;
19
20
import java .util .Map .Entry ;
20
21
import java .util .Optional ;
22
+ import java .util .Set ;
21
23
import java .util .regex .Pattern ;
22
24
23
25
import org .apache .http .HttpStatus ;
@@ -194,8 +196,12 @@ public Optional<SecurityResponse> reRequestAuthentication(final SecurityRequest
194
196
);
195
197
}
196
198
197
- public String getJwtUrlParameter () {
198
- return jwtUrlParameter ;
199
+ @ Override
200
+ public Set <String > getSensitiveUrlParams () {
201
+ if (jwtUrlParameter != null ) {
202
+ return Set .of (jwtUrlParameter );
203
+ }
204
+ return Collections .emptySet ();
199
205
}
200
206
201
207
@ Override
Original file line number Diff line number Diff line change 78
78
import org .opensearch .threadpool .ThreadPool ;
79
79
import org .opensearch .transport .TransportRequest ;
80
80
81
- import com .amazon .dlic .auth .http .jwt .HTTPJwtAuthenticator ;
82
81
import com .flipkart .zjsonpatch .JsonDiff ;
83
82
import org .greenrobot .eventbus .Subscribe ;
84
83
@@ -946,12 +945,7 @@ public void onDynamicConfigModelChanged(DynamicConfigModel dcm) {
946
945
SortedSet <AuthDomain > authDomains = Collections .unmodifiableSortedSet (dcm .getRestAuthDomains ());
947
946
ignoredUrlParams .clear ();
948
947
for (AuthDomain authDomain : authDomains ) {
949
- if ("jwt" .equals (authDomain .getHttpAuthenticator ().getType ())) {
950
- HTTPJwtAuthenticator jwtAuthenticator = (HTTPJwtAuthenticator ) authDomain .getHttpAuthenticator ();
951
- if (jwtAuthenticator .getJwtUrlParameter () != null ) {
952
- ignoredUrlParams .add (jwtAuthenticator .getJwtUrlParameter ());
953
- }
954
- }
948
+ ignoredUrlParams .addAll (authDomain .getHttpAuthenticator ().getSensitiveUrlParams ());
955
949
}
956
950
}
957
951
}
Original file line number Diff line number Diff line change 26
26
27
27
package org .opensearch .security .auth ;
28
28
29
+ import java .util .Collections ;
29
30
import java .util .Optional ;
31
+ import java .util .Set ;
30
32
31
33
import org .opensearch .OpenSearchSecurityException ;
32
34
import org .opensearch .common .util .concurrent .ThreadContext ;
@@ -92,4 +94,14 @@ public interface HTTPAuthenticator {
92
94
default boolean supportsImpersonation () {
93
95
return true ;
94
96
}
97
+
98
+ /**
99
+ * Returns a set of URL parameters this authenticator supports that are considered sensitive
100
+ * and should be redacted in the audit logs
101
+ *
102
+ * @return The set of URL parameters considered sensitive for this authenticator.
103
+ */
104
+ default Set <String > getSensitiveUrlParams () {
105
+ return Collections .emptySet ();
106
+ }
95
107
}
You can’t perform that action at this time.
0 commit comments