Java Code Examples for javax.servlet.http.HttpServletRequest#BASIC_AUTH

The following examples show how to use javax.servlet.http.HttpServletRequest#BASIC_AUTH . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AuthenticationMessageServlet.java    From quarkus-http with Apache License 2.0 9 votes vote down vote up
private void checkExpectedMechanism(HttpServletRequest req) {
    String expectedMechanism = req.getHeader("ExpectedMechanism");
    if (expectedMechanism == null) {
        throw new IllegalStateException("No ExpectedMechanism received.");
    }
    if (expectedMechanism.equals("None")) {
        if (req.getAuthType() != null) {
            throw new IllegalStateException("Authentication occurred when not expected.");
        }
    } else if (expectedMechanism.equals("BASIC")) {
        if (req.getAuthType() != HttpServletRequest.BASIC_AUTH) {
            throw new IllegalStateException("Expected mechanism type not matched.");
        }
    } else {
        throw new IllegalStateException("ExpectedMechanism not recognised.");
    }
}
 
Example 2
Source File: BasicAuthenticator.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
@Override
protected String getAuthMethod() {
    return HttpServletRequest.BASIC_AUTH;
}
 
Example 3
Source File: ExceptionUtils.java    From onedev with MIT License 4 votes vote down vote up
private static void requireAuthentication(HttpServletResponse response) {
	response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
    String authcHeader = HttpServletRequest.BASIC_AUTH + " realm=\"" + OneDev.NAME + "\"";
    response.setHeader(HttpHeaders.WWW_AUTHENTICATE, authcHeader);
}
 
Example 4
Source File: BasicAuthenticationService.java    From orion.server with Eclipse Public License 1.0 4 votes vote down vote up
public String getAuthType() {
	return HttpServletRequest.BASIC_AUTH;
}
 
Example 5
Source File: BasicAuthenticator.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
@Override
protected String getAuthMethod() {
    return HttpServletRequest.BASIC_AUTH;
}
 
Example 6
Source File: OpenCPSAuthHeaderAuthVerifier.java    From opencps-v2 with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public String getAuthType() {
	return HttpServletRequest.BASIC_AUTH;
}
 
Example 7
Source File: BasicAuthenticator.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
@Override
protected String getAuthMethod() {
    return HttpServletRequest.BASIC_AUTH;
}
 
Example 8
Source File: LuteceDefaultAdminAuthentication.java    From lutece-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public String getAuthType( HttpServletRequest request )
{
    return HttpServletRequest.BASIC_AUTH;
}