Announcement Announcement Module
Collapse
No announcement yet.
Having my own User for the security context, the Roo way Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Having my own User for the security context, the Roo way

    Hi guys,

    In my application I've got a Person that I want to use for authentication. As mentioned here http://forum.springsource.org/showthread.php?t=90941 I extended my Person class to inherit from org.springframework.security.core.userdetails.User . That gave me a compile error since I had to implement the constructor:

    Code:
    	public Person(String username, String password, boolean enabled,
    			boolean accountNonExpired, boolean credentialsNonExpired,
    			boolean accountNonLocked, Collection<GrantedAuthority> authorities) {
    		super(username, password, enabled, accountNonExpired, credentialsNonExpired,
    				accountNonLocked, authorities);
    	}
    No problem there, except that when I compile I get

    Code:
    error at super();
    
    /Users/niklas/Documents/Eclipse/myProject/src/main/java/dk/mycompany/myProject/data/entities/Person_Roo_Entity.aj:32:0::0 The constructor User() is undefined
    So it tries to make a constructor that is empty, which is not valid for User. What would be the correct way to handle this?

    Cheers

    Nik

  • #2
    Instead of extending User I suggest simply implement the UserDetails interface and implement as you like. That is what I tend to do, but I tend also to have my own UserDetailsService implementation with that.

    Comment


    • #3
      No I don't think this is the problem. I've tried ever since Sunday night, but it just doesn't work.


      ------------------------

      page-rank-checker.org | http://plagiarismdetector.net/
      Last edited by leo76; Jan 17th, 2014, 01:07 AM.

      Comment

      Working...
      X