//user class içi @Override public Collection getAuthorities() { /* * List authorities = new ArrayList<>(); * authorities.add(new SimpleGrantedAuthority("Admin")); authorities.add(new * SimpleGrantedAuthority("CompanyUser")); authorities.add(new * SimpleGrantedAuthority("Driver")); * * return authorities; */ if(getUserRoleId()==1) { return AuthorityUtils.createAuthorityList("Role_admin"); }else if(getUserRoleId()==2) { return AuthorityUtils.createAuthorityList("Role_companyUser"); } return AuthorityUtils.createAuthorityList("Role_driver"); } //security configuration class içi http.authorizeRequests() //.antMatchers("/api/1.0/auth").hasAnyAuthority("Role_admin","Role_companyUser", "Role_driver") //.antMatchers("/api/1.0/admin/**").hasAuthority("Role_admin") //.antMatchers("/api/1.0/companyUser/**").hasAuthority("Role_companyUser") //.antMatchers("/api/1.0/driver/**").hasAuthority("Role_driver") //.antMatchers("/api/1.0/adminCompany/**").hasAnyAuthority("Role_admin","Role_companyUser") //.antMatchers("/api/1.0/adminDriver/**").hasAnyAuthority("Role_admin","Role_driver") //.antMatchers("/api/1.0/companyDriver/**").hasAnyAuthority("Role_admin","Role_driver") //.antMatchers("/api/1.0/all/**").hasAnyAuthority("Role_admin","Role_companyUser","Role_driver") //.anyRequest().authenticated() //.and() //.formLogin().permitAll() .and() .logout().permitAll() .and() //.exceptionHandling().accessDeniedPage("/403");