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

io.muserver.rest.UserPassAuthenticator Maven / Gradle / Ivy

There is a newer version: 2.0.3
Show newest version
package io.muserver.rest;

import javax.ws.rs.core.SecurityContext;
import java.security.Principal;

/**
 * An authenticator used by {@link BasicAuthSecurityFilter} which can look up a user based on a username and password.
 */
public interface UserPassAuthenticator {
    /**
     * 

Looks up a user.

*

It is required that the user object implements the Principal interface, so if you have custom classes for * users you may need to wrap them to include this.

*

You can later get the principle from a {@link javax.ws.rs.core.SecurityContext} (using the @Context * annotation on a REST method) and cast {@link SecurityContext#getUserPrincipal()} to your custom class.

* @param username The username * @param password The password * @return The user, or null if the credentials are invalid. */ Principal authenticate(String username, String password); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy