diff src/org/eclipse/jetty/server/Request.java @ 815:07c82fabc46b

remove Authentication
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 09 Sep 2016 14:27:05 -0600
parents f8f7cb485c25
children 8e9db0bbf4f9
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/Request.java	Fri Sep 09 10:37:37 2016 -0600
+++ b/src/org/eclipse/jetty/server/Request.java	Fri Sep 09 14:27:05 2016 -0600
@@ -180,7 +180,6 @@
 	protected final AsyncContinuation _async = new AsyncContinuation();
 	private boolean _asyncSupported = true;
 	private volatile Attributes _attributes;
-	private Authentication _authentication;
 	private MultiMap<String> _baseParameters;
 	private String _characterEncoding;
 	protected AbstractHttpConnection _connection;
@@ -457,27 +456,11 @@
 	}
 
 	/* ------------------------------------------------------------ */
-	/**
-	 * Get the authentication.
-	 *
-	 * @return the authentication
-	 */
-	public Authentication getAuthentication()
-	{
-		return _authentication;
-	}
-
-	/* ------------------------------------------------------------ */
 	/*
 	 * @see javax.servlet.http.HttpServletRequest#getAuthType()
 	 */
 	public String getAuthType()
 	{
-		if (_authentication instanceof Authentication.Deferred)
-			setAuthentication(((Authentication.Deferred)_authentication).authenticate(this));
-		
-		if (_authentication instanceof Authentication.User)
-			return ((Authentication.User)_authentication).getAuthMethod();
 		return null;
 	}
 
@@ -1277,9 +1260,6 @@
 	 */
 	public Principal getUserPrincipal()
 	{
-		if (_authentication instanceof Authentication.Deferred)
-			setAuthentication(((Authentication.Deferred)_authentication).authenticate(this));
-
 		return null;
 	}
 
@@ -1363,8 +1343,6 @@
 	 */
 	public boolean isUserInRole(String role)
 	{
-		if (_authentication instanceof Authentication.Deferred)
-			setAuthentication(((Authentication.Deferred)_authentication).authenticate(this));
 		return false;
 	}
 
@@ -1392,7 +1370,6 @@
 			}
 		}
 
-		setAuthentication(Authentication.NOT_CHECKED);
 		_async.recycle();
 		_asyncSupported = true;
 		_handled = false;
@@ -1564,18 +1541,6 @@
 	/* ------------------------------------------------------------ */
 
 	/* ------------------------------------------------------------ */
-	/**
-	 * Set the authentication.
-	 *
-	 * @param authentication
-	 *            the authentication to set
-	 */
-	public void setAuthentication(Authentication authentication)
-	{
-		_authentication = authentication;
-	}
-
-	/* ------------------------------------------------------------ */
 	/*
 	 * @see javax.servlet.ServletRequest#setCharacterEncoding(java.lang.String)
 	 */
@@ -1875,13 +1840,7 @@
 	/* ------------------------------------------------------------ */
 	public boolean authenticate(HttpServletResponse response) throws IOException, ServletException
 	{
-		if (_authentication instanceof Authentication.Deferred)
-		{
-			setAuthentication(((Authentication.Deferred)_authentication).authenticate(this,response));
-			return !(_authentication instanceof Authentication.ResponseSent);        
-		}
-		response.sendError(HttpStatus.UNAUTHORIZED_401);
-		return false;
+		throw new UnsupportedOperationException();
 	}
 
 	/* ------------------------------------------------------------ */
@@ -1949,24 +1908,13 @@
 	/* ------------------------------------------------------------ */
 	public void login(String username, String password) throws ServletException
 	{
-		if (_authentication instanceof Authentication.Deferred) 
-		{
-			_authentication=((Authentication.Deferred)_authentication).login(username,password,this);
-			if (_authentication == null)
-				throw new ServletException();
-		} 
-		else 
-		{
-			throw new ServletException("Authenticated as "+_authentication);
-		}
+		throw new UnsupportedOperationException();
 	}
 
 	/* ------------------------------------------------------------ */
 	public void logout() throws ServletException
 	{
-		if (_authentication instanceof Authentication.User)
-			((Authentication.User)_authentication).logout();
-		_authentication=Authentication.UNAUTHENTICATED;
+		throw new UnsupportedOperationException();
 	}
 	
 	/* ------------------------------------------------------------ */