@@ -66,6 +66,7 @@ public class AuthUtil {
6666
6767 Map <String , Boolean > urlMapping = null ;
6868 private static final org .slf4j .Logger LOGGER = LoggerFactory .getLogger (AuthUtil .class );
69+ private static Boolean isMiseLogInitialized = false ;
6970
7071 public boolean isValidToken (String token ) {
7172 LOGGER .info ("Starting token validation..." );
@@ -118,14 +119,39 @@ private boolean validateTokenWithPublicKey(String token) {
118119 }
119120 }
120121
121- public boolean validateTokenWithMISE (String token ) {
122+ private boolean validateTokenWithMISE (String token ) {
122123 LOGGER .info ("Starting MISE token validation..." );
123124
124125 try {
125126 // Mise mise = Mise.createClient();
126127 Class <?> miseClass = Class .forName ("com.microsoft.identity.service.essentials.Mise" );
127128 Object mise = miseClass .getMethod ("createClient" ).invoke (null );
128129
130+ if (!isMiseLogInitialized ) {
131+ LOGGER .info ("Initializing MISE..." );
132+ // mise.assignLogMessageCallback(new Mise.ILogCallback() {...}, null);
133+ Class <?> iLogCallbackClass = Class .forName ("com.microsoft.identity.service.essentials.Mise$ILogCallback" );
134+
135+ Object logCallback = java .lang .reflect .Proxy .newProxyInstance (
136+ iLogCallbackClass .getClassLoader (),
137+ new Class <?>[]{iLogCallbackClass },
138+ (proxy , method , args ) -> {
139+ String methodName = method .getName ();
140+ if ("callback" .equals (methodName )) {
141+ Object level = args [0 ];
142+ String message = (String ) args [1 ];
143+ // Print all log levels for simplicity
144+ LOGGER .info (message );
145+ }
146+ return null ;
147+ }
148+ );
149+
150+ miseClass .getMethod ("assignLogMessageCallback" , iLogCallbackClass , Object .class )
151+ .invoke (mise , logCallback , null );
152+ isMiseLogInitialized = true ;
153+ }
154+
129155 // Configure MISE
130156 JSONObject config = new JSONObject ();
131157 JSONObject azureAd = new JSONObject ();
0 commit comments