/** * Get user's identity ({@link AuthException} * if not authenticated). * @return Identity, if authenticated */ @Cacheable(lifetime = 1, unit = TimeUnit.SECONDS) public Identity identity() { Identity identity = this.ofProviders(); if (identity.equals(Identity.ANONYMOUS)) { identity = this.ofCookies(); } return identity; }