Created
January 22, 2019 16:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package in.springframework.blog.tutorials; | |
import java.security.Principal; | |
import java.util.Optional; | |
/** | |
* Created by vinay on 2/3/16. | |
*/ | |
public class UsernamePasswordPrincipal implements Principal { | |
public UsernamePasswordPrincipal(Optional<String> username, Optional<String> password) { | |
this.username = username; | |
this.password = password; | |
this.newUser = false; | |
} | |
public UsernamePasswordPrincipal(Optional<String> username, Optional<String> password, boolean newUser) { | |
this.username = username; | |
this.password = password; | |
this.newUser = newUser; | |
} | |
@Override | |
public String getName() { | |
return username.get(); | |
} | |
public Optional<String> getUsername() { | |
return username; | |
} | |
public Optional<String> getPassword() { | |
return password; | |
} | |
public boolean isNewUser() { | |
return newUser; | |
} | |
private final Optional<String> username; | |
private final Optional<String> password; | |
private final boolean newUser; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment