@ Override protected String [ ] getRoles ( Principal inPrincipal , ServletRequest inRequest ) { UserEntity user = this . userDao . getByPrincipal ( inPrincipal ) ; if ( user != null ) { return user . getRoleNames ( ) ; } else { return null ; } }
The getRoles method will now return Null if UserObject not found EMPTY_ARRAY if the user found and don t have any associated roles and String Array if the user found and have associated roles .