Last change
on this file since c45b67b was c71fa06, checked in by andrejTavchioski <andrej.tavchioski@…>, 3 years ago |
change in getParkingSpaces logic
|
-
Property mode
set to
100644
|
File size:
934 bytes
|
Rev | Line | |
---|
[ce6ad22] | 1 | package parkup;
|
---|
| 2 |
|
---|
| 3 | import org.springframework.boot.SpringApplication;
|
---|
| 4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
|
---|
[c71fa06] | 5 | import org.springframework.context.annotation.Bean;
|
---|
| 6 | import org.springframework.security.core.Authentication;
|
---|
| 7 | import org.springframework.security.core.context.SecurityContextHolder;
|
---|
[ce6ad22] | 8 |
|
---|
| 9 | @SpringBootApplication
|
---|
| 10 | public class ParkUpApplication {
|
---|
| 11 | public ParkUpApplication() {
|
---|
| 12 | }
|
---|
| 13 |
|
---|
| 14 | public static void main(String[] args) {
|
---|
| 15 | SpringApplication.run(ParkUpApplication.class, args);
|
---|
| 16 | }
|
---|
[c71fa06] | 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 | }
|
---|
[ce6ad22] | 27 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.