Skip to content

Commit

Permalink
fix(core): add null check to auth in FiatPermissionEvaluator.getUsern…
Browse files Browse the repository at this point in the history
…ame (#435)
  • Loading branch information
maggieneterval committed Jul 3, 2019
1 parent bd52240 commit f228238
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ public static Optional<AuthorizationFailure> getAuthorizationFailure() {

private String getUsername(Authentication authentication) {
String username = "anonymous";
if (authentication.isAuthenticated() && authentication.getPrincipal() != null) {
if (authentication != null
&& authentication.isAuthenticated()
&& authentication.getPrincipal() != null) {
Object principal = authentication.getPrincipal();
if (principal instanceof User) {
username = ((User) principal).getUsername();
Expand Down

0 comments on commit f228238

Please sign in to comment.