// Path: src/main/java/com/epam/reportportal/auth/util/AuthUtils.java
// public static final Function<String, String> CROP_DOMAIN = it -> normalizeId(StringUtils.substringBefore(it, "@"));


import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.saml.SamlAuthentication;
import org.springframework.security.saml.saml2.authentication.Assertion;
import org.springframework.security.saml.saml2.authentication.SubjectPrincipal;
import org.springframework.security.saml.spi.DefaultSamlAuthentication;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
import static com.epam.reportportal.auth.util.AuthUtils.CROP_DOMAIN;
		issuer = assertion.getIssuer().getValue();
	}

	public ReportPortalSamlAuthentication(DefaultSamlAuthentication defaultSamlAuthentication) {
		this(
				defaultSamlAuthentication.isAuthenticated(),
				defaultSamlAuthentication.getAssertion(),
				defaultSamlAuthentication.getAssertingEntityId(),
				defaultSamlAuthentication.getHoldingEntityId(),
				defaultSamlAuthentication.getRelayState()
		);
	}

	private void fillAttributes(Assertion assertion) {
		List<Attribute> mappedAttributes = assertion.getAttributes()
				.stream()
				.map(attr -> new Attribute().setName(attr.getName())
						.setFriendlyName(attr.getFriendlyName())
						.setNameFormat(attr.getNameFormat().toString())
						.setRequired(attr.isRequired())
						.setValues(attr.getValues()))
				.collect(Collectors.toList());
		attributes.addAll(mappedAttributes);
	}

	private void fillSubject(Assertion assertion) {
		subject = new Subject().setSamlPrincipal(new SamlPrincipal().setFormat(assertion.getSubject()
				.getPrincipal()
				.getFormat()
				.getFormat()
// Path: src/main/java/com/epam/reportportal/auth/util/AuthUtils.java
// public static final Function<String, String> CROP_DOMAIN = it -> normalizeId(StringUtils.substringBefore(it, "@"));


// Path: src/main/java/com/epam/reportportal/auth/integration/saml/ReportPortalSamlAuthentication.java
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.saml.SamlAuthentication;
import org.springframework.security.saml.saml2.authentication.Assertion;
import org.springframework.security.saml.saml2.authentication.SubjectPrincipal;
import org.springframework.security.saml.spi.DefaultSamlAuthentication;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
import static com.epam.reportportal.auth.util.AuthUtils.CROP_DOMAIN;

		issuer = assertion.getIssuer().getValue();
	}

	public ReportPortalSamlAuthentication(DefaultSamlAuthentication defaultSamlAuthentication) {
		this(
				defaultSamlAuthentication.isAuthenticated(),
				defaultSamlAuthentication.getAssertion(),
				defaultSamlAuthentication.getAssertingEntityId(),
				defaultSamlAuthentication.getHoldingEntityId(),
				defaultSamlAuthentication.getRelayState()
		);
	}

	private void fillAttributes(Assertion assertion) {
		List<Attribute> mappedAttributes = assertion.getAttributes()
				.stream()
				.map(attr -> new Attribute().setName(attr.getName())
						.setFriendlyName(attr.getFriendlyName())
						.setNameFormat(attr.getNameFormat().toString())
						.setRequired(attr.isRequired())
						.setValues(attr.getValues()))
				.collect(Collectors.toList());
		attributes.addAll(mappedAttributes);
	}

	private void fillSubject(Assertion assertion) {
		subject = new Subject().setSamlPrincipal(new SamlPrincipal().setFormat(assertion.getSubject()
				.getPrincipal()
				.getFormat()
				.getFormat()
				.toString()).setValue(CROP_DOMAIN.apply(assertion.getSubject().getPrincipal().getValue())));