Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is my custom authentication not working in Spring Security 3?
    primarykey
    data
    text
    <p>I'm having an issue with spring security 3 while trying to implement my own Customauthentication. Following <a href="http://pastebin.com/N2szNkzi" rel="nofollow">this</a> page steps I wrote this class:</p> <pre><code>public class CustomAuth implements AuthenticationManager { @Override public Authentication authenticate(Authentication auth) throws AuthenticationException { UserService service = new UserService(); User user = service.login((String) auth.getPrincipal(), new String( DigestUtils.sha256((String) auth.getCredentials()))); LinkedList&lt;GrantedAuthority&gt; authorities = new LinkedList&lt;&gt;(); if (user != null) { authorities.add(new SimpleGrantedAuthority(user.getRole())); return new UsernamePasswordAuthenticationToken(user.getUsername(), user.getPassword(), authorities); } return null; } } </code></pre> <p>And this is my spring-security.xml</p> <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"&gt; &lt;security:http pattern="/resources/**" security="none" /&gt; &lt;security:http auto-config="true" &gt; &lt;security:intercept-url pattern="/user/**" access="ROLE_USER" /&gt; &lt;security:intercept-url pattern="/admin/**" access="ROLE_ADMIN,ROLE_USER" /&gt; &lt;security:form-login login-page="/login" authentication-failure-url="/login?error=true" /&gt; &lt;security:logout invalidate-session="true" /&gt; &lt;security:session-management&gt; &lt;security:concurrency-control max-sessions="1" /&gt; &lt;/security:session-management&gt; &lt;/security:http&gt; &lt;security:authentication-manager&gt; &lt;security:authentication-provider ref="myAuthProvider" /&gt; &lt;/security:authentication-manager&gt; &lt;bean id="myAuthProvider" class="org.jhonnytunes.security.CustomAuth"&gt; &lt;/bean&gt; &lt;/beans&gt; </code></pre> <p>And tomcat7 is logging <a href="http://pastebin.com/N2szNkzi" rel="nofollow">this</a> while app not displaying at browser.</p> <p>Im using:</p> <ol> <li>Eclipse Kepler</li> <li>Ubuntu 13.04</li> <li>JDK 1.7</li> <li>Tomcat7</li> <li>Eclipse STS plugin</li> </ol> <p>What can be this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload