Skip to content

Commit

Permalink
fixed NPE on RequestPropsInjecterTransformer for property userName on…
Browse files Browse the repository at this point in the history
… not authenticated requests
  • Loading branch information
ujibang committed May 15, 2018
1 parent 5bb0ef2 commit 1422bc3
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,17 @@ HashMap<String, BsonValue> getPropsValues(
final RequestContext context) {
HashMap<String, BsonValue> properties = new HashMap<>();

// remote user
properties.put("userName", new BsonString(
ExchangeAttributes

String _userName = ExchangeAttributes
.remoteUser()
.readAttribute(exchange)));
.readAttribute(exchange);

BsonValue userName = _userName != null
? new BsonString(_userName)
: BsonNull.VALUE;

// remote user
properties.put("userName", userName);

// user roles
if (Objects.nonNull(exchange.getSecurityContext())
Expand Down

0 comments on commit 1422bc3

Please sign in to comment.