- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/app/src/main/java/parkup/ParkUpApplication.java
rce6ad22 rc71fa06 3 3 import org.springframework.boot.SpringApplication; 4 4 import org.springframework.boot.autoconfigure.SpringBootApplication; 5 import org.springframework.context.annotation.Bean; 6 import org.springframework.security.core.Authentication; 7 import org.springframework.security.core.context.SecurityContextHolder; 5 8 6 9 @SpringBootApplication … … 12 15 SpringApplication.run(ParkUpApplication.class, args); 13 16 } 17 18 @Bean 19 public static Authentication getToken() { 20 Authentication token = null; 21 Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); 22 if (authentication != null && !authentication.getAuthorities().stream().findFirst().get().getAuthority().equals("ROLE_ANONYMOUS")) { 23 token = authentication; 24 } 25 return token; 26 } 14 27 }
Note:
See TracChangeset
for help on using the changeset viewer.