@@ -46,7 +46,7 @@ public KetoAuthorizationProvider(Map<String, Object> options) {
4646 throw new IllegalArgumentException ("Cannot pass empty or null options to KetoAuth" );
4747 }
4848 ApiClient defaultClient = Configuration .getDefaultApiClient ();
49- defaultClient .setBasePath ((String )options .get ("basePath" ));
49+ defaultClient .setBasePath ((String ) options .get ("basePath" ));
5050 this .apiInstance = new EnginesApi (defaultClient );
5151 this .options = options ;
5252 }
@@ -59,9 +59,8 @@ public KetoAuthorizationProvider(Map<String, Object> options) {
5959 * @return AuthorizationResult result of authorization query
6060 */
6161 public AuthorizationResult checkAccess (String project , Authentication authentication ) {
62- String subject = (String )this .options .get ("subject" );
63- if ((subject == null ) || (subject .isEmpty ()))
64- subject = "email" ;
62+ String subject = (String ) this .options .get ("subject" );
63+ if ((subject == null ) || (subject .isEmpty ())) subject = "email" ;
6564 String subjectValue = getSubjectFromAuth (authentication , subject );
6665 try {
6766 // Get all roles from Keto
@@ -91,7 +90,7 @@ public AuthorizationResult checkAccess(String project, Authentication authentica
9190 }
9291 // Could not determine project membership, deny access.
9392 return AuthorizationResult .failed (
94- String .format ("Access denied to project %s for user %s" , project , email ));
93+ String .format ("Access denied to project %s for user %s" , project , subjectValue ));
9594 }
9695
9796 /**
@@ -104,7 +103,7 @@ public AuthorizationResult checkAccess(String project, Authentication authentica
104103 private String getSubjectFromAuth (Authentication authentication , String subject ) {
105104 Jwt principle = ((Jwt ) authentication .getPrincipal ());
106105 Map <String , Object > claims = principle .getClaims ();
107- String subjectValue = (String )claims .get (subject );
106+ String subjectValue = (String ) claims .get (subject );
108107
109108 if (subjectValue .isEmpty ()) {
110109 throw new IllegalStateException (String .format ("JWT does not have a valid %s." , subject ));
0 commit comments