Results 1 to 2 of 2

Thread: Having my own User for the security context, the Roo way

  1. #1

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •