Skip to content

Commit bc2423c

Browse files
authored
Merge pull request #24 from UnityFoundation-io/bug-handle-null-names-when-authenticating
Bug fix - handle null names when authenticating
2 parents 75b690d + ec4c3e4 commit bc2423c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

UnityAuth/src/main/java/io/unityfoundation/auth/UnityAuthenticationProvider.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import reactor.core.scheduler.Schedulers;
1818

1919
import java.util.Map;
20+
import java.util.Objects;
2021

2122
@Singleton
2223
public class UnityAuthenticationProvider implements AuthenticationProvider<HttpRequest<?>> {
@@ -50,10 +51,14 @@ public Publisher<AuthenticationResponse> authenticate(@Nullable HttpRequest<?> h
5051
} else {
5152
return Mono.just(AuthenticationResponse.success(
5253
(String) authenticationRequest.getIdentity(),
53-
Map.of("first_name", user.getFirstName(), "last_name", user.getLastName())
54+
Map.of(
55+
"first_name", Objects.toString(user.getFirstName(), ""),
56+
"last_name", Objects.toString(user.getLastName(), "")
57+
)
5458
));
5559
}
56-
}); }
60+
});
61+
}
5762

5863
private AuthenticationFailed validate(User user,
5964
AuthenticationRequest<?, ?> authenticationRequest) {

0 commit comments

Comments
 (0)