PL-9404 New Authentication subsystem

Check not null credentials argument
This commit is contained in:
Yuriy Artamonov 2017-09-27 09:36:07 +04:00
parent 0e9dc819db
commit 23dff655e0

View File

@ -39,6 +39,8 @@ import javax.persistence.NoResultException;
import java.lang.reflect.UndeclaredThrowableException;
import java.util.List;
import static com.haulmont.bali.util.Preconditions.checkNotNullArgument;
@Component(AuthenticationManager.NAME)
public class AuthenticationManagerBean implements AuthenticationManager {
@ -61,6 +63,8 @@ public class AuthenticationManagerBean implements AuthenticationManager {
@Override
@Nonnull
public AuthenticationDetails login(Credentials credentials) throws LoginException {
checkNotNullArgument(credentials, "credentials should not be null");
AuthenticationDetails authenticationDetails = null;
try (Transaction tx = persistence.getTransaction()) {
@ -100,6 +104,8 @@ public class AuthenticationManagerBean implements AuthenticationManager {
@Override
@Nonnull
public AuthenticationDetails authenticate(Credentials credentials) throws LoginException {
checkNotNullArgument(credentials, "credentials should not be null");
try (Transaction tx = persistence.getTransaction()) {
AuthenticationDetails authenticationDetails = authenticateInternal(credentials);