- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/app/src/main/java/parkup/ParkUpApplication.java
rc71fa06 rce6ad22 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;8 5 9 6 @SpringBootApplication … … 15 12 SpringApplication.run(ParkUpApplication.class, args); 16 13 } 17 18 @Bean19 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 }27 14 }
Note:
See TracChangeset
for help on using the changeset viewer.