taglib not anymore needed
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1395902 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ef9564e7a7
commit
51b836a084
|
@ -130,12 +130,6 @@
|
|||
<artifactId>jsr250-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils-bean-collections</artifactId>
|
||||
<version>1.7.0</version>
|
||||
<!-- Needed by extremecomponents -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
|
@ -145,19 +139,7 @@
|
|||
<artifactId>servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jsp-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>taglibs</groupId>
|
||||
<artifactId>standard</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
package org.apache.archiva.redback.integration.taglib.jsp;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
|
||||
|
||||
/**
|
||||
* IfAuthorizedTag:
|
||||
*
|
||||
* @author Jesse McConnell <jesse@codehaus.org>
|
||||
*
|
||||
*/
|
||||
public class ElseAuthorizedTag
|
||||
extends ConditionalTagSupport
|
||||
{
|
||||
protected boolean condition()
|
||||
throws JspTagException
|
||||
{
|
||||
Boolean authzStatus = (Boolean) pageContext.getAttribute( "ifAuthorizedTag" );
|
||||
|
||||
if ( authzStatus != null )
|
||||
{
|
||||
pageContext.removeAttribute( "ifAuthorizedTag" );
|
||||
|
||||
return !authzStatus.booleanValue();
|
||||
}
|
||||
|
||||
authzStatus = (Boolean) pageContext.getAttribute( "ifAnyAuthorizedTag" );
|
||||
|
||||
if ( authzStatus != null )
|
||||
{
|
||||
pageContext.removeAttribute( "ifAnyAuthorizedTag" );
|
||||
|
||||
return !authzStatus.booleanValue();
|
||||
}
|
||||
|
||||
throw new JspTagException( "ElseAuthorizedTag should follow either IfAuthorized or IfAnyAuthorized" );
|
||||
}
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
package org.apache.archiva.redback.integration.taglib.jsp;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.redback.authorization.AuthorizationException;
|
||||
import org.apache.archiva.redback.system.SecuritySession;
|
||||
import org.apache.archiva.redback.system.SecuritySystem;
|
||||
import org.apache.archiva.redback.system.SecuritySystemConstants;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* IfAnyAuthorizedTag:
|
||||
*
|
||||
* @author Jesse McConnell <jesse@codehaus.org>
|
||||
*
|
||||
*/
|
||||
public class IfAnyAuthorizedTag
|
||||
extends ConditionalTagSupport
|
||||
{
|
||||
/**
|
||||
* comma delimited list of permissions to check
|
||||
*/
|
||||
private String permissions;
|
||||
|
||||
private String resource;
|
||||
|
||||
public void setPermissions( String permissions )
|
||||
{
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
public void setResource( String resource )
|
||||
{
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
protected boolean condition()
|
||||
throws JspTagException
|
||||
{
|
||||
ApplicationContext applicationContext =
|
||||
WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() );
|
||||
|
||||
SecuritySession securitySession =
|
||||
(SecuritySession) pageContext.getSession().getAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY );
|
||||
|
||||
try
|
||||
{
|
||||
final SecuritySystem securitySystem = applicationContext.getBean( "securitySystem", SecuritySystem.class );
|
||||
if ( securitySystem == null )
|
||||
{
|
||||
throw new JspTagException( "unable to locate the security system" );
|
||||
}
|
||||
|
||||
StringTokenizer strtok = new StringTokenizer( permissions, "," );
|
||||
|
||||
while ( strtok.hasMoreTokens() )
|
||||
{
|
||||
String permission = strtok.nextToken().trim();
|
||||
|
||||
if ( securitySystem.isAuthorized( securitySession, permission, resource ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( AuthorizationException ae )
|
||||
{
|
||||
throw new JspTagException( "error with authorization", ae );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
package org.apache.archiva.redback.integration.taglib.jsp;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.redback.authorization.AuthorizationException;
|
||||
import org.apache.archiva.redback.system.SecuritySession;
|
||||
import org.apache.archiva.redback.system.SecuritySystem;
|
||||
import org.apache.archiva.redback.system.SecuritySystemConstants;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
|
||||
|
||||
/**
|
||||
* IfAuthorizedTag:
|
||||
*
|
||||
* @author Jesse McConnell <jesse@codehaus.org>
|
||||
*
|
||||
*/
|
||||
public class IfAuthorizedTag
|
||||
extends ConditionalTagSupport
|
||||
{
|
||||
private String permission;
|
||||
|
||||
private String resource;
|
||||
|
||||
public void setPermission( String permission )
|
||||
{
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
public void setResource( String resource )
|
||||
{
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
protected boolean condition()
|
||||
throws JspTagException
|
||||
{
|
||||
ApplicationContext applicationContext =
|
||||
WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() );
|
||||
|
||||
Boolean authzStatusBool = (Boolean) pageContext.getAttribute( "redbackCache" + permission + resource );
|
||||
boolean authzStatus;
|
||||
|
||||
//long execTime = System.currentTimeMillis();
|
||||
|
||||
if ( authzStatusBool == null )
|
||||
{
|
||||
SecuritySession securitySession =
|
||||
(SecuritySession) pageContext.getSession().getAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY );
|
||||
|
||||
try
|
||||
{
|
||||
SecuritySystem securitySystem = applicationContext.getBean( "securitySystem", SecuritySystem.class );
|
||||
if ( securitySystem == null )
|
||||
{
|
||||
throw new JspTagException( "unable to locate security system" );
|
||||
}
|
||||
|
||||
authzStatus = securitySystem.isAuthorized( securitySession, permission, resource );
|
||||
pageContext.setAttribute( "redbackCache" + permission + resource, Boolean.valueOf( authzStatus ) );
|
||||
}
|
||||
catch ( AuthorizationException ae )
|
||||
{
|
||||
throw new JspTagException( "error with authorization", ae );
|
||||
}
|
||||
|
||||
//System.out.println( "[PERF] " + "redbackCache" + permission + resource + " Time: " + (System.currentTimeMillis() - execTime) );
|
||||
}
|
||||
else
|
||||
{
|
||||
authzStatus = authzStatusBool.booleanValue();
|
||||
//System.out.println( "[PERF][Cached] " + "redbackCache" + permission + resource + " Time: " + (System.currentTimeMillis() - execTime) );
|
||||
}
|
||||
|
||||
pageContext.setAttribute( "ifAuthorizedTag", Boolean.valueOf( authzStatus ) );
|
||||
return authzStatus;
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
package org.apache.archiva.redback.integration.taglib.jsp;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.redback.configuration.UserConfiguration;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
|
||||
|
||||
/**
|
||||
* IfConfiguredTag:
|
||||
*
|
||||
* @author Jesse McConnell <jesse@codehaus.org>
|
||||
*
|
||||
*/
|
||||
public class IfConfiguredTag
|
||||
extends ConditionalTagSupport
|
||||
{
|
||||
private String option;
|
||||
|
||||
private String value;
|
||||
|
||||
public void setOption( String option )
|
||||
{
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public void setValue( String value )
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
protected boolean condition()
|
||||
throws JspTagException
|
||||
{
|
||||
ApplicationContext applicationContext =
|
||||
WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() );
|
||||
|
||||
UserConfiguration config = applicationContext.getBean( "userConfiguration", UserConfiguration.class );
|
||||
|
||||
if ( value != null )
|
||||
{
|
||||
String configValue = config.getString( option );
|
||||
|
||||
if ( value.equals( configValue ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return config.getBoolean( option );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package org.apache.archiva.redback.integration.taglib.jsp;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.redback.users.UserManager;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
|
||||
|
||||
/**
|
||||
* IsReadOnlyUserManagerTag:
|
||||
*
|
||||
* @author Jesse McConnell <jesse@codehaus.org>
|
||||
*
|
||||
*/
|
||||
public class IsNotReadOnlyUserManagerTag
|
||||
extends ConditionalTagSupport
|
||||
{
|
||||
protected boolean condition()
|
||||
throws JspTagException
|
||||
{
|
||||
ApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(pageContext.getServletContext());
|
||||
|
||||
UserManager config = applicationContext.getBean( "userManager#configurable" , UserManager.class );
|
||||
if (config == null)
|
||||
{
|
||||
throw new JspTagException( "unable to locate security system" );
|
||||
}
|
||||
|
||||
return !config.isReadOnly();
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package org.apache.archiva.redback.integration.taglib.jsp;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.redback.users.UserManager;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
|
||||
|
||||
/**
|
||||
* IsReadOnlyUserManagerTag:
|
||||
*
|
||||
* @author Jesse McConnell <jesse@codehaus.org>
|
||||
*
|
||||
*/
|
||||
public class IsReadOnlyUserManagerTag
|
||||
extends ConditionalTagSupport
|
||||
{
|
||||
protected boolean condition()
|
||||
throws JspTagException
|
||||
{
|
||||
ApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(pageContext.getServletContext());
|
||||
UserManager config = applicationContext.getBean( "userManager#configurable" , UserManager.class );
|
||||
if (config == null)
|
||||
{
|
||||
throw new JspTagException( "unable to locate security system" );
|
||||
}
|
||||
|
||||
return config.isReadOnly();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue