You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2002/12/03 17:04:45 UTC
cvs commit: xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication AuthenticationConstants.java
cziegeler 2002/12/03 08:04:44
Modified: src/java/org/apache/cocoon/environment/wrapper
EnvironmentWrapper.java
src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/acting
AuthAction.java LogoutAction.java
src/blocks/portal-fw/java/org/apache/cocoon/webapps/portal/components
PortalManager.java
src/blocks/portal-fw/java/org/apache/cocoon/webapps/portal/context
SessionContextImpl.java
SessionContextProviderImpl.java
src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/context
SessionContextProviderImpl.java
src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components
AuthenticationManager.java
src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication
AuthenticationConstants.java
Log:
Removing internal hacks for authentication
Revision Changes Path
1.23 +1 -3 xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
Index: EnvironmentWrapper.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- EnvironmentWrapper.java 2 Dec 2002 08:39:17 -0000 1.22
+++ EnvironmentWrapper.java 3 Dec 2002 16:04:44 -0000 1.23
@@ -173,8 +173,6 @@
this,
rawMode);
this.objectModel.put(ObjectModelHelper.REQUEST_OBJECT, this.request);
-
- this.objectModel.put("Internal-Request", "true");
}
/**
1.2 +4 -20 xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/acting/AuthAction.java
Index: AuthAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/acting/AuthAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AuthAction.java 27 Sep 2002 09:05:06 -0000 1.1
+++ AuthAction.java 3 Dec 2002 16:04:44 -0000 1.2
@@ -95,36 +95,20 @@
AuthenticationManager authManager = null;
Map map = null;
- boolean initialized;
-
try {
final Request request = ObjectModelHelper.getRequest( objectModel );
- // Are we called as an internal resource?
- if ( objectModel.get("Internal-Request") != null ) {
- handlerName = (String)request.getAttribute(AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME);
- applicationName = (String)request.getAttribute(AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME);
- initialized = true;
- } else {
- handlerName = par.getParameter("handler", null);
- applicationName = par.getParameter("application", null);
- if (handlerName != null) request.setAttribute(AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME, handlerName);
- if (applicationName != null) request.setAttribute(AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME, applicationName);
- initialized = false;
- }
+ handlerName = par.getParameter("handler", null);
+ applicationName = par.getParameter("application", null);
authManager = (AuthenticationManager) this.manager.lookup( AuthenticationManager.ROLE );
// do authentication
- if (authManager.checkAuthentication(redirector, !initialized) == false) {
+ if ( !authManager.checkAuthentication(redirector, handlerName, applicationName) ) {
// All events are ignored
// the sitemap.xsl ensures that only the redirect is processed
} else {
- if (initialized == false) {
- map = authManager.createMap();
- } else {
- map = EMPTY_MAP;
- }
+ map = authManager.createMap();
}
} finally {
this.manager.release( authManager );
1.2 +9 -12 xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/acting/LogoutAction.java
Index: LogoutAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/acting/LogoutAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LogoutAction.java 27 Sep 2002 09:05:06 -0000 1.1
+++ LogoutAction.java 3 Dec 2002 16:04:44 -0000 1.2
@@ -64,7 +64,6 @@
import org.apache.cocoon.acting.ComposerAction;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.webapps.authentication.AuthenticationConstants;
import org.apache.cocoon.webapps.authentication.components.AuthenticationManager;
@@ -92,12 +91,6 @@
", par="+par);
}
- final Request request = ObjectModelHelper.getRequest( objectModel );
- final String handlerName = par.getParameter("handler",
- (String)request.getAttribute(AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME));
- if ( null == handlerName )
- throw new ProcessingException("LogoutAction requires at least the handler parameter.");
-
int mode;
final String modeString = par.getParameter("mode", "if-not-authenticated");
if ( modeString.equals("if-not-authenticated") ) {
@@ -110,13 +103,17 @@
throw new ProcessingException("Unknown mode " + modeString);
}
- // authenticate
- AuthenticationManager manager = null;
+ // logout
+ AuthenticationManager authManager = null;
try {
- manager = (AuthenticationManager) this.manager.lookup(AuthenticationManager.ROLE);
- manager.logout( handlerName , mode );
+ authManager = (AuthenticationManager) this.manager.lookup(AuthenticationManager.ROLE);
+ final String handlerName = par.getParameter("handler",
+ authManager.getHandlerName());
+ if ( null == handlerName )
+ throw new ProcessingException("LogoutAction requires at least the handler parameter.");
+ authManager.logout( handlerName , mode );
} finally {
- this.manager.release( manager );
+ this.manager.release( authManager );
}
if (this.getLogger().isDebugEnabled() == true) {
1.6 +37 -27 xml-cocoon2/src/blocks/portal-fw/java/org/apache/cocoon/webapps/portal/components/PortalManager.java
Index: PortalManager.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/blocks/portal-fw/java/org/apache/cocoon/webapps/portal/components/PortalManager.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PortalManager.java 3 Dec 2002 13:52:13 -0000 1.5
+++ PortalManager.java 3 Dec 2002 16:04:44 -0000 1.6
@@ -278,7 +278,7 @@
final Session session = this.getSessionManager().getSession(false);
if (session != null) {
synchronized(session) {
- String appName = (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME);
+ String appName = this.getAuthenticationManager().getApplicationName();
String attrName = PortalConstants.PRIVATE_SESSION_CONTEXT_NAME;
if (appName != null) {
attrName = attrName + ':' + appName;
@@ -513,8 +513,8 @@
SourceParameters pars = new SourceParameters();
pars.setSingleParameterValue("profile", "coplet-base");
- pars.setSingleParameterValue("application", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME));
- pars.setSingleParameterValue("handler", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME));
+ pars.setSingleParameterValue("application", this.getAuthenticationManager().getApplicationName());
+ pars.setSingleParameterValue("handler", this.getAuthenticationManager().getHandlerName());
String saveResource = (String)configuration.get(PortalConstants.CONF_COPLETBASE_SAVE_RESOURCE);
@@ -665,7 +665,7 @@
// load the base coplets profile
if (copletsFragment == null) {
SourceParameters pars = new SourceParameters();
- pars.setSingleParameterValue("application", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME));
+ pars.setSingleParameterValue("application", this.getAuthenticationManager().getApplicationName());
String res = (String)configuration.get(PortalConstants.CONF_COPLETBASE_RESOURCE);
if (res == null) {
throw new ProcessingException("No configuration for portal-coplet base profile found.");
@@ -866,7 +866,7 @@
Map portalLayouts;
Map copleyLayouts;
Node[] miscNodes;
- String mediaType = (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_MEDIA_TYPE);
+ String mediaType = this.getAuthenticationManager().getMediaType();
profile = (DocumentFragment)storedProfile.get(PortalConstants.PROFILE_PROFILE);
portalLayouts = (Map)storedProfile.get(PortalConstants.PROFILE_PORTAL_LAYOUTS);
@@ -1571,12 +1571,13 @@
public String getProfileID(String type,
String role,
String id,
- boolean adminProfile) {
+ boolean adminProfile)
+ throws ProcessingException {
// No sync required
StringBuffer key = new StringBuffer((adminProfile == true ? "aprofile:" : "uprofile:"));
- key.append((String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME))
+ key.append(this.getAuthenticationManager().getHandlerName())
.append('|')
- .append((String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME))
+ .append(this.getAuthenticationManager().getApplicationName())
.append(':')
.append(type);
@@ -2706,7 +2707,7 @@
boolean visible = DOMUtil.getValueAsBooleanOf(element,
"status/visible");
// second: check media
- String media = (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_MEDIA_TYPE);
+ String media = this.getAuthenticationManager().getMediaType();
if (visible == true && copletConf.hasAttributeNS(null, "media") == true) {
String copletMedia = copletConf.getAttributeNS(null, "media");
visible = media.equals(copletMedia);
@@ -2905,13 +2906,22 @@
}
/**
+ * Get the current media type
+ */
+ public String getMediaType()
+ throws ProcessingException {
+ return this.getAuthenticationManager().getMediaType();
+ }
+
+ /**
* Get the coplet with the id
*/
private Element getCopletConfiguration(String copletID,
Map defaultCoplets,
- Map mediaCoplets) {
+ Map mediaCoplets)
+ throws ProcessingException {
// calling method is synced
- String media = (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_MEDIA_TYPE);
+ String media = this.getAuthenticationManager().getMediaType();
Map coplets = (Map)mediaCoplets.get(media);
Element coplet = null;
if (coplets != null) coplet = (Element)coplets.get(copletID);
@@ -3270,8 +3280,8 @@
this.getLogger().debug("BEGIN getConfiguration");
}
Map result = null;
- String appName = (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME);
- String handlerName = (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME);
+ String appName = this.getAuthenticationManager().getApplicationName();
+ String handlerName = this.getAuthenticationManager().getHandlerName();
Session session = this.getSessionManager().getSession(false);
if (session != null && appName != null && handlerName != null) {
@@ -3506,8 +3516,8 @@
String res;
SourceParameters pars = new SourceParameters();
- pars.setSingleParameterValue("application", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME));
- pars.setSingleParameterValue("handler", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME));
+ pars.setSingleParameterValue("application", this.getAuthenticationManager().getApplicationName());
+ pars.setSingleParameterValue("handler", this.getAuthenticationManager().getHandlerName());
pars.setSingleParameterValue("profile", "coplet-base");
// First load the base profiles: copletProfile + layoutProfile
@@ -3602,8 +3612,8 @@
throw new ProcessingException("No configuration for portal-role delta profile found.");
}
SourceParameters pars = new SourceParameters();
- pars.setSingleParameterValue("application", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME));
- pars.setSingleParameterValue("handler", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME));
+ pars.setSingleParameterValue("application", this.getAuthenticationManager().getApplicationName());
+ pars.setSingleParameterValue("handler", this.getAuthenticationManager().getHandlerName());
pars.setSingleParameterValue("profile", "global-delta");
if (this.getLogger().isDebugEnabled() == true) {
@@ -3658,8 +3668,8 @@
SourceParameters pars;
pars = new SourceParameters();
pars.setSingleParameterValue("role", role);
- pars.setSingleParameterValue("application", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME));
- pars.setSingleParameterValue("handler", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME));
+ pars.setSingleParameterValue("application", this.getAuthenticationManager().getApplicationName());
+ pars.setSingleParameterValue("handler", this.getAuthenticationManager().getHandlerName());
pars.setSingleParameterValue("profile", "role-delta");
String res = (String)config.get(PortalConstants.CONF_ROLEDELTA_LOADRESOURCE);
@@ -3715,8 +3725,8 @@
pars = new SourceParameters();
pars.setSingleParameterValue("ID", id);
pars.setSingleParameterValue("role", role);
- pars.setSingleParameterValue("application", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME));
- pars.setSingleParameterValue("handler", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME));
+ pars.setSingleParameterValue("application", this.getAuthenticationManager().getApplicationName());
+ pars.setSingleParameterValue("handler", this.getAuthenticationManager().getHandlerName());
pars.setSingleParameterValue("profile", "user-delta");
String res = (String)config.get(PortalConstants.CONF_USERDELTA_LOADRESOURCE);
@@ -3781,8 +3791,8 @@
pars = new SourceParameters();
pars.setSingleParameterValue("ID", id);
pars.setSingleParameterValue("role", role);
- pars.setSingleParameterValue("application", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME));
- pars.setSingleParameterValue("handler", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME));
+ pars.setSingleParameterValue("application", this.getAuthenticationManager().getApplicationName());
+ pars.setSingleParameterValue("handler", this.getAuthenticationManager().getHandlerName());
pars.setSingleParameterValue("profile", "user-status");
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("loading user status profile");
@@ -3849,8 +3859,8 @@
pars = new SourceParameters();
pars.setSingleParameterValue("ID", id);
pars.setSingleParameterValue("role", role);
- pars.setSingleParameterValue("application", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME));
- pars.setSingleParameterValue("handler", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME));
+ pars.setSingleParameterValue("application", this.getAuthenticationManager().getApplicationName());
+ pars.setSingleParameterValue("handler", this.getAuthenticationManager().getHandlerName());
pars.setSingleParameterValue("profile", "user-status");
SourceUtil.writeDOM(res,
@@ -4038,8 +4048,8 @@
pars.setSingleParameterValue("type", profileType);
if (id != null) pars.setSingleParameterValue("ID", id);
if (role != null) pars.setSingleParameterValue("role", role);
- pars.setSingleParameterValue("application", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME));
- pars.setSingleParameterValue("handler", (String)this.request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME));
+ pars.setSingleParameterValue("application", this.getAuthenticationManager().getApplicationName());
+ pars.setSingleParameterValue("handler", this.getAuthenticationManager().getHandlerName());
SourceUtil.writeDOM(saveResource,
null,
pars,
1.3 +1 -1 xml-cocoon2/src/blocks/portal-fw/java/org/apache/cocoon/webapps/portal/context/SessionContextImpl.java
Index: SessionContextImpl.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/blocks/portal-fw/java/org/apache/cocoon/webapps/portal/context/SessionContextImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SessionContextImpl.java 8 Oct 2002 14:43:20 -0000 1.2
+++ SessionContextImpl.java 3 Dec 2002 16:04:44 -0000 1.3
@@ -159,7 +159,7 @@
this.statusProfile = (Element)info.get(PortalConstants.COPLETINFO_STATUSPROFILE);
}
this.mediaType = (this.copletPars != null ? (String)copletPars.getParameter(PortalConstants.PARAMETER_MEDIA)
- : (String)request.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_MEDIA_TYPE));
+ : portal.getMediaType());
// get the profile
SessionContext context = portal.getContext(false);
1.2 +1 -2 xml-cocoon2/src/blocks/portal-fw/java/org/apache/cocoon/webapps/portal/context/SessionContextProviderImpl.java
Index: SessionContextProviderImpl.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/blocks/portal-fw/java/org/apache/cocoon/webapps/portal/context/SessionContextProviderImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SessionContextProviderImpl.java 27 Sep 2002 09:05:17 -0000 1.1
+++ SessionContextProviderImpl.java 3 Dec 2002 16:04:44 -0000 1.2
@@ -121,8 +121,7 @@
info.put(PortalConstants.COPLETINFO_PARAMETERS, pars);
pars.setSingleParameterValue(PortalConstants.PARAMETER_ID, copletID);
pars.setSingleParameterValue(PortalConstants.PARAMETER_NUMBER, copletNumber);
- pars.setSingleParameterValue(PortalConstants.PARAMETER_MEDIA,
- (String)req.getAttribute(org.apache.cocoon.webapps.authentication.AuthenticationConstants.REQUEST_ATTRIBUTE_MEDIA_TYPE));
+ pars.setSingleParameterValue(PortalConstants.PARAMETER_MEDIA, portal.getMediaType());
info.put(PortalConstants.COPLETINFO_STATUSPROFILE, portal.getStatusProfile());
info.put(PortalConstants.COPLETINFO_PORTALURI, req.getRequestURI());
1.2 +19 -5 xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/context/SessionContextProviderImpl.java
Index: SessionContextProviderImpl.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/context/SessionContextProviderImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SessionContextProviderImpl.java 27 Sep 2002 09:05:17 -0000 1.1
+++ SessionContextProviderImpl.java 3 Dec 2002 16:04:44 -0000 1.2
@@ -51,6 +51,8 @@
package org.apache.cocoon.webapps.authentication.context;
import java.util.Map;
+
+import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.environment.ObjectModelHelper;
@@ -58,6 +60,7 @@
import org.apache.cocoon.environment.Session;
import org.apache.excalibur.source.SourceResolver;
import org.apache.cocoon.webapps.authentication.AuthenticationConstants;
+import org.apache.cocoon.webapps.authentication.components.AuthenticationManager;
import org.apache.cocoon.webapps.session.context.SessionContext;
import org.apache.cocoon.webapps.session.context.SessionContextProvider;
import org.apache.cocoon.webapps.session.components.SessionManager;
@@ -89,12 +92,23 @@
SessionContext context = null;
if (name.equals(org.apache.cocoon.webapps.authentication.AuthenticationConstants.SESSION_CONTEXT_NAME) == true) {
final Request req = ObjectModelHelper.getRequest(objectModel);
- final String handlerName = (String)req.getAttribute(AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME);
- final String appName = (String)req.getAttribute(AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME);
final Session session = req.getSession(false);
- if (session != null && handlerName != null) {
- context = (SessionContext)session.getAttribute(AuthenticationConstants.SESSION_ATTRIBUTE_CONTEXT_NAME);
- context = new SessionContextImpl(context, name, handlerName, appName, resolver, manager);
+
+ if ( null != session ) {
+ AuthenticationManager authManager = null;
+ try {
+ authManager = (AuthenticationManager)manager.lookup(AuthenticationManager.ROLE);
+ final String handlerName = authManager.getHandlerName();
+ final String appName = authManager.getApplicationName();
+ if ( null != handlerName ) {
+ context = new SessionContextImpl((SessionContext)session.getAttribute(AuthenticationConstants.SESSION_ATTRIBUTE_CONTEXT_NAME),
+ name, handlerName, appName, resolver, manager);
+ }
+ } catch (ComponentException ce) {
+ throw new ProcessingException("Unabled to lookup authentication manager.", ce);
+ } finally {
+ manager.release(authManager);
+ }
}
}
return context;
1.6 +20 -8 xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components/AuthenticationManager.java
Index: AuthenticationManager.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components/AuthenticationManager.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AuthenticationManager.java 21 Nov 2002 18:18:48 -0000 1.5
+++ AuthenticationManager.java 3 Dec 2002 16:04:44 -0000 1.6
@@ -197,7 +197,6 @@
}
}
this.mediaType = (media == null ? this.defaultMediaType : media.name);
- this.request.setAttribute(AuthenticationConstants.REQUEST_ATTRIBUTE_MEDIA_TYPE, this.mediaType);
}
/**
@@ -284,6 +283,14 @@
}
/**
+ * Return the current media type
+ */
+ public String getMediaType() {
+ // synchronized
+ return this.mediaType;
+ }
+
+ /**
* Return the current handler
*/
public Handler getHandler() {
@@ -291,6 +298,13 @@
}
/**
+ * Return the current handler name
+ */
+ public String getHandlerName() {
+ return this.handlerName;
+ }
+
+ /**
* Return the name of the current application
*/
public String getApplicationName() {
@@ -330,7 +344,9 @@
/**
* Checks authentication and generates a redirect, if not authenticated
*/
- public boolean checkAuthentication(Redirector redirector, boolean loadingResource)
+ public boolean checkAuthentication(Redirector redirector,
+ final String newHandlerName,
+ final String newAppName)
throws IOException, ProcessingException {
// synchronized not needed
if (this.getLogger().isDebugEnabled() == true) {
@@ -339,8 +355,6 @@
boolean isAuthenticated = true;
// set the configuration for the handler
- final String newHandlerName = (String)this.request.getAttribute(AuthenticationConstants.REQUEST_ATTRIBUTE_HANDLER_NAME);
- final String newAppName = (String)this.request.getAttribute(AuthenticationConstants.REQUEST_ATTRIBUTE_APPLICATION_NAME);
if (this.handlerName == null) this.handlerName = "";
if (this.applicationName == null) this.applicationName = "";
if (this.handlerName.equals(newHandlerName) == false
@@ -386,11 +400,9 @@
final String redirectURI = handler.getRedirectURI();
redirector.globalRedirect(false, SourceUtil.appendParameters(redirectURI, parameters));
} else {
- if (loadingResource == true) {
- // load application data if we are not inside a resource loading of authentication
- this.checkLoaded((SessionContextImpl)this.getSessionManager().getContext(AuthenticationConstants.SESSION_CONTEXT_NAME),
+ // load application data if we are not inside a resource loading of authentication
+ this.checkLoaded((SessionContextImpl)this.getSessionManager().getContext(AuthenticationConstants.SESSION_CONTEXT_NAME),
"/");
- }
}
}
1.2 +0 -4 xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/AuthenticationConstants.java
Index: AuthenticationConstants.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/AuthenticationConstants.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AuthenticationConstants.java 27 Sep 2002 09:05:18 -0000 1.1
+++ AuthenticationConstants.java 3 Dec 2002 16:04:44 -0000 1.2
@@ -59,10 +59,6 @@
*/
public interface AuthenticationConstants {
- String REQUEST_ATTRIBUTE_HANDLER_NAME = "org.apache.cocoon.webapps.authentication.HandlerName";
- String REQUEST_ATTRIBUTE_APPLICATION_NAME = "org.apache.cocoon.webapps.authentication.ApplicationName";
- String REQUEST_ATTRIBUTE_MEDIA_TYPE = "org.apache.cocoon.webapps.authentication.MediaType";
-
/** The name of the session attribute storing the context */
String SESSION_ATTRIBUTE_CONTEXT_NAME = "org.apache.cocoon.webapps.authentication.SessionContext";
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org