[Bug 394144] add jetty-jaspi
This commit is contained in:
parent
3d27933600
commit
952d6b7316
|
@ -19,6 +19,7 @@
|
||||||
package org.eclipse.jetty.security.jaspi;
|
package org.eclipse.jetty.security.jaspi;
|
||||||
|
|
||||||
import java.security.Principal;
|
import java.security.Principal;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -137,7 +138,7 @@ public class JaspiAuthenticatorFactory extends DefaultAuthenticatorFactory
|
||||||
{
|
{
|
||||||
if (_serviceSubject!=null)
|
if (_serviceSubject!=null)
|
||||||
return _serviceSubject;
|
return _serviceSubject;
|
||||||
List subjects = server.getBeans(Subject.class);
|
List<Subject> subjects = (List<Subject>)server.getBeans(Subject.class);
|
||||||
if (subjects.size()>0)
|
if (subjects.size()>0)
|
||||||
return (Subject)subjects.get(0);
|
return (Subject)subjects.get(0);
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -31,7 +31,7 @@ import javax.security.auth.message.MessagePolicy;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpHeaders;
|
import org.eclipse.jetty.http.HttpHeader;
|
||||||
import org.eclipse.jetty.util.security.Constraint;
|
import org.eclipse.jetty.util.security.Constraint;
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
import org.eclipse.jetty.util.log.Logger;
|
||||||
|
@ -75,7 +75,7 @@ public class BasicAuthModule extends BaseAuthModule
|
||||||
{
|
{
|
||||||
HttpServletRequest request = (HttpServletRequest) messageInfo.getRequestMessage();
|
HttpServletRequest request = (HttpServletRequest) messageInfo.getRequestMessage();
|
||||||
HttpServletResponse response = (HttpServletResponse) messageInfo.getResponseMessage();
|
HttpServletResponse response = (HttpServletResponse) messageInfo.getResponseMessage();
|
||||||
String credentials = request.getHeader(HttpHeaders.AUTHORIZATION);
|
String credentials = request.getHeader(HttpHeader.AUTHORIZATION.asString());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -87,7 +87,7 @@ public class BasicAuthModule extends BaseAuthModule
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isMandatory(messageInfo)) { return AuthStatus.SUCCESS; }
|
if (!isMandatory(messageInfo)) { return AuthStatus.SUCCESS; }
|
||||||
response.setHeader(HttpHeaders.WWW_AUTHENTICATE, "basic realm=\"" + realmName + '"');
|
response.setHeader(HttpHeader.WWW_AUTHENTICATE.asString(), "basic realm=\"" + realmName + '"');
|
||||||
response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
|
response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
|
||||||
return AuthStatus.SEND_CONTINUE;
|
return AuthStatus.SEND_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import javax.security.auth.message.MessagePolicy;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpHeaders;
|
import org.eclipse.jetty.http.HttpHeader;
|
||||||
import org.eclipse.jetty.util.security.Constraint;
|
import org.eclipse.jetty.util.security.Constraint;
|
||||||
import org.eclipse.jetty.util.security.Credential;
|
import org.eclipse.jetty.util.security.Credential;
|
||||||
import org.eclipse.jetty.util.B64Code;
|
import org.eclipse.jetty.util.B64Code;
|
||||||
|
@ -87,7 +87,7 @@ public class DigestAuthModule extends BaseAuthModule
|
||||||
{
|
{
|
||||||
HttpServletRequest request = (HttpServletRequest) messageInfo.getRequestMessage();
|
HttpServletRequest request = (HttpServletRequest) messageInfo.getRequestMessage();
|
||||||
HttpServletResponse response = (HttpServletResponse) messageInfo.getResponseMessage();
|
HttpServletResponse response = (HttpServletResponse) messageInfo.getResponseMessage();
|
||||||
String credentials = request.getHeader(HttpHeaders.AUTHORIZATION);
|
String credentials = request.getHeader(HttpHeader.AUTHORIZATION.asString());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -155,7 +155,7 @@ public class DigestAuthModule extends BaseAuthModule
|
||||||
if (!isMandatory(messageInfo)) { return AuthStatus.SUCCESS; }
|
if (!isMandatory(messageInfo)) { return AuthStatus.SUCCESS; }
|
||||||
String domain = request.getContextPath();
|
String domain = request.getContextPath();
|
||||||
if (domain == null) domain = "/";
|
if (domain == null) domain = "/";
|
||||||
response.setHeader(HttpHeaders.WWW_AUTHENTICATE, "Digest realm=\"" + realmName
|
response.setHeader(HttpHeader.WWW_AUTHENTICATE.asString(), "Digest realm=\"" + realmName
|
||||||
+ "\", domain=\""
|
+ "\", domain=\""
|
||||||
+ domain
|
+ domain
|
||||||
+ "\", nonce=\""
|
+ "\", nonce=\""
|
||||||
|
|
6
pom.xml
6
pom.xml
|
@ -407,6 +407,7 @@
|
||||||
<module>jetty-distribution</module>
|
<module>jetty-distribution</module>
|
||||||
<module>jetty-spring</module>
|
<module>jetty-spring</module>
|
||||||
<module>jetty-client</module>
|
<module>jetty-client</module>
|
||||||
|
<module>jetty-jaspi</module>
|
||||||
<module>jetty-osgi</module>
|
<module>jetty-osgi</module>
|
||||||
<module>examples/embedded</module>
|
<module>examples/embedded</module>
|
||||||
<module>examples/async-rest</module>
|
<module>examples/async-rest</module>
|
||||||
|
@ -420,7 +421,6 @@
|
||||||
|
|
||||||
<module>jetty-runner</module>
|
<module>jetty-runner</module>
|
||||||
<module>jetty-rhttp</module>
|
<module>jetty-rhttp</module>
|
||||||
<module>jetty-jaspi</module>
|
|
||||||
<module>jetty-proxy</module>
|
<module>jetty-proxy</module>
|
||||||
<module>jetty-monitor</module>
|
<module>jetty-monitor</module>
|
||||||
<module>jetty-nested</module>
|
<module>jetty-nested</module>
|
||||||
|
@ -578,9 +578,7 @@
|
||||||
<profile>
|
<profile>
|
||||||
<id>release</id>
|
<id>release</id>
|
||||||
<modules>
|
<modules>
|
||||||
<!--
|
<!-- module>aggregates/jetty-all</module-->
|
||||||
<module>jetty-aggregate</module>
|
|
||||||
-->
|
|
||||||
</modules>
|
</modules>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
|
|
Loading…
Reference in New Issue