title: Getting user locale from KeycloakPrincipal
body: <p>I have configured keycloak filter, that sets <code>KeycloakPrincipal</code> in <code>HttpServletRequest</code>. So far so good.</p>
  
  <p>I've found out where the field <code>locale</code> is located:</p>
  
  <pre><code>KeycloakPrincipal&lt;KeycloakSecurityContext&gt; principal = (KeycloakPrincipal&lt;KeycloakSecurityContext&gt;) req.getUserPrincipal();
  String locale = principal.getKeycloakSecurityContext().getToken().getLocale();
  </code></pre>
  
  <p>However, I get null, although I see locale in user's profile:</p>
  
  <p><a href="https://i.stack.imgur.com/PX5RT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PX5RT.png" alt="keycloak admin console"></a></p>
  
  <p>How to get the user locale from the <code>KeycloakPrincipal</code>? </p>