The very first time an application is lanched. How is it possible to generate a user? In the security.xml it is possible to create som user.
Code:<authentication-manager alias="authenticationManager"> <authentication-provider user-service-ref="jdbcUserService"> <password-encoder ref="passwordEncoder"> <salt-source ref="saltSource"/> </password-encoder> </authentication-provider> <authentication-provider> <user-service> <user name="user" password="user" authorities="ROLE_USER" /> <user name="sectionadmin" password="sectionadmin" authorities="ROLE_SECTIONADMIN" /> <user name="companyadmin" password="companyadmin" authorities="ROLE_COMPANYADMIN" /> <user name="superadmin" password="superadmin" authorities="ROLE_SUPERADMIN" /> </user-service> </authentication-provider> </authentication-manager>
The problem is that these users are like the my Person objects. I have my Person objects in a table. The users I declare in security.xml does not end up in my "Person table" in my DB.
So if I do for example this
The users declared in the security.xml cant be used like this. How do I create my very First person object? I would like to remove the lines that declares roles in the web.xml but I need a Person to sign in with.Code:Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); String username; if (principal instanceof Person) { username = ((Person) principal).getFirstName(); } else { username = principal.toString(); }
We are using Hibernate/Postgres.
Thanks


Reply With Quote