code: protected CommonProfile getAuthenticatedProfile(final HttpServletRequest request,
                                                      final HttpServletResponse response,
                                                      final String requiredPermission) {
          val context = new J2EContext(request, response, getUmaConfigurationContext().getSessionStore());
          val manager = new ProfileManager<>(context, context.getSessionStore());
          val profile = manager.get(true).orElse(null);
          if (profile == null) {
              throw new AuthenticationException("Unable to locate authenticated profile");
          }
          if (!profile.getPermissions().contains(requiredPermission)) {
              throw new AuthenticationException("Authenticated profile does not carry the UMA protection scope");
          }
          return profile;
      }
docs: Gets authenticated profile.
  
  @param request            the request
  @param response           the response
  @param requiredPermission the required permission
  @return the authenticated profile