Add security context.
Set principal in filter.
Fix PMD warnings.