GSDa
GSDa

Reputation: 193

Showing menu depending on authenticated User : Using spring security

I already did a research, I found one way using <sec:authorize ifNotGranted="ROLE_ANONYMOUS">. but unfortunately sec taglib is not working for me. I tried every single solution in the web but in vain.

Is there any other way to show content depending on user without using taglib ?

Upvotes: 0

Views: 417

Answers (2)

GSDa
GSDa

Reputation: 193

It's working now, obviously there was a conflict, I had to exclude manually each spring-security-taglib dependency.

 <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-taglibs</artifactId>
        <version>3.1.1.RELEASE</version>
        <exclusions>
            <exclusion>
            <artifactId>jsp-api</artifactId>
            <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>servlet-api</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-security-acl</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-security-core</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-security-web</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-aop</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-beans</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-context</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-core</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-expression</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-web</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>

        </exclusions>
    </dependency>

Upvotes: 0

barthezzko
barthezzko

Reputation: 17

Make sure you've added the spring-security-taglibs library to your project.

For example, if you are using maven for resolving the dependencies.

<dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-taglibs</artifactId>
        <version>3.1.3.RELEASE</version>
        <exclusions>
            <exclusion>
                <artifactId>spring-aop</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
        </exclusions>
    </dependency>

Upvotes: 1

Related Questions