I think this block (line 37 - 40) can be replaced by the following:

```java
SecurityContextHolder.getContext().getAuthentication()
```