All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nepxion.discovery.console.authentication.AuthenticationResourceImpl Maven / Gradle / Ivy

There is a newer version: 6.22.0
Show newest version
package com.nepxion.discovery.console.authentication;

/**
 * 

Title: Nepxion Discovery

*

Description: Nepxion Discovery

*

Copyright: Copyright (c) 2017-2050

*

Company: Nepxion

* @author Haojun Ren * @version 1.0 */ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import com.nepxion.discovery.common.entity.UserEntity; public class AuthenticationResourceImpl implements AuthenticationResource { @Autowired private Environment environment; @Override public boolean authenticate(UserEntity userEntity) throws Exception { String userId = userEntity.getUserId().trim(); String password = userEntity.getPassword().trim(); String passwordValue = environment.getProperty(userId); if (StringUtils.isNotEmpty(passwordValue)) { return StringUtils.equals(password, passwordValue); } else { throw new IllegalArgumentException("Not exists for [" + userId + "]"); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy