code: @Override
      public Optional<String> getRemoteAddress() {
          return getDetails().flatMap(details -> {
              String address;
              if (details instanceof OAuth2AuthenticationDetails) {
                  address = OAuth2AuthenticationDetails.class.cast(details).getRemoteAddress();
              } else if (details instanceof WebAuthenticationDetails) {
                  address = WebAuthenticationDetails.class.cast(details).getRemoteAddress();
              } else {
                  throw new IllegalStateException("Unsupported auth details type " + details.getClass());
              }
  
              return Optional.ofNullable(address);
          });
      }
docs: {@inheritDoc}