All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rollbar.web.provider.PersonProvider Maven / Gradle / Ivy

package com.rollbar.web.provider;

import com.rollbar.api.payload.data.Person;
import com.rollbar.notifier.provider.Provider;
import com.rollbar.web.listener.RollbarRequestListener;
import jakarta.servlet.http.HttpServletRequest;

public class PersonProvider implements Provider {

  @Override
  public Person provide() {
    HttpServletRequest request = RollbarRequestListener.getServletRequest();

    if (request != null && request.getUserPrincipal() != null) {
      return new Person.Builder()
          .id(request.getUserPrincipal().getName())
          .build();
    }
    return null;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy