SpringSecurityTaglib

Spring security taglib as it should be

License

License

Categories

Categories

Security
GroupId

GroupId

com.aerse
ArtifactId

ArtifactId

spring-security-taglib
Last Version

Last Version

1.1
Release Date

Release Date

Type

Type

jar
Description

Description

SpringSecurityTaglib
Spring security taglib as it should be
Project URL

Project URL

https://github.com/dernasherbrezon/spring-security-taglib
Source Code Management

Source Code Management

https://github.com/dernasherbrezon/spring-security-taglib

Download spring-security-taglib

How to add to project

<!-- https://jarcasting.com/artifacts/com.aerse/spring-security-taglib/ -->
<dependency>
    <groupId>com.aerse</groupId>
    <artifactId>spring-security-taglib</artifactId>
    <version>1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.aerse/spring-security-taglib/
implementation 'com.aerse:spring-security-taglib:1.1'
// https://jarcasting.com/artifacts/com.aerse/spring-security-taglib/
implementation ("com.aerse:spring-security-taglib:1.1")
'com.aerse:spring-security-taglib:jar:1.1'
<dependency org="com.aerse" name="spring-security-taglib" rev="1.1">
  <artifact name="spring-security-taglib" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.aerse', module='spring-security-taglib', version='1.1')
)
libraryDependencies += "com.aerse" % "spring-security-taglib" % "1.1"
[com.aerse/spring-security-taglib "1.1"]

Dependencies

compile (2)

Group / Artifact Type Version
javax.servlet : jsp-api jar 2.0
org.springframework.security : spring-security-config jar 3.2.1.RELEASE

Project Modules

There are no modules declared in this project.

spring-security-taglib

Spring security taglib as it should be. Internally original spring security taglib calls spring expression to evaluate:

		Expression accessExpression;
		try {
			accessExpression = handler.getExpressionParser().parseExpression(getAccess());
		}

This could be made much easier: compare current user roles with requested role.

Usage

Include dependency:

		<dependency>
			<groupId>com.aerse</groupId>
			<artifactId>spring-security-taglib</artifactId>
		</dependency>

Configure taglib:

<%@ taglib prefix="cfn" uri="https://github.com/dernasherbrezon/spring-security-taglib" %>

And use:

<cfn:authorize access="ROLE_ANONYMOUS">
	<a href="/login">Login</a>
</cfn:authorize>
<cfn:authorize access="ROLE_USER">
	<a href="/logout">Logout</a>
</cfn:authorize>

Supported configuration parameters:

  • access. Single role to check
  • any. Comma separated roles to check. At least one role required to evaluate body

Versions

Version
1.1