Gets required name id format if any.

@param authnRequest the authn request
@return the required name id format if any
512858
protected static String getRequiredNameIdFormatIfAny(final RequestAbstractType authnRequest) {
        val nameIDPolicy = getNameIDPolicy(authnRequest);
        val requiredNameFormat = nameIDPolicy != null ? nameIDPolicy.getFormat() : null;
        LOGGER.debug("AuthN request indicates [{}] is the required NameID format", requiredNameFormat);
        return requiredNameFormat;
    }
901632
public String getName() {
        if (name == null && securityIdentity != null) {
            name = securityIdentity.getPrincipal().getName();
        }

        return name;
    }
832071
public static String getDomain(HttpServletRequest request) {

		if (request == null) {
			return null;
		}

		return UrlUtils.resolveDomain(request.getServerName());
	}
313800
function getRequestId(req) {
  const id = uuid.v1();
  req.id = id;
  return {
    req_id: id,
  };
}
509695
public static Tag clientName(HttpRequest request) {
		String host = request.getURI().getHost();
		if (host == null) {
			host = "none";
		}
		return Tag.of("clientName", host);
	}
1168881
func (sp *ServiceProvider) MakeAuthenticationRequest(idpURL string) (*AuthnRequest, error) {
	var nameIDFormat string
	switch sp.AuthnNameIDFormat {
	case "":
		// To maintain library back-compat, use "transient" if unset.
		nameIDFormat = string(TransientNameIDFormat)
	case UnspecifiedNameIDFormat:
		// Spec defines an empty value as "unspecified" so don't set one.
	default:
		nameIDFormat = string(sp.AuthnNameIDFormat)
	}

	allowCreate := true
	req := AuthnRequest{
		AssertionConsumerServiceURL: sp.AcsURL.String(),
		Destination:                 idpURL,
		ProtocolBinding:             HTTPPostBinding, // default binding for the response
		ID:                          fmt.Sprintf("id-%x", randomBytes(20)),
		IssueInstant:                TimeNow(),
		Version:                     "2.0",
		Issuer: &Issuer{
			Format: "urn:oasis:names:tc:SAML:2.0:nameid-format:entity",
			Value:  sp.MetadataURL.String(),
		},
		NameIDPolicy: &NameIDPolicy{
			AllowCreate: &allowCreate,
			// TODO(ross): figure out exactly policy we need
			// urn:mace:shibboleth:1.0:nameIdentifier
			// urn:oasis:names:tc:SAML:2.0:nameid-format:transient
			Format: &nameIDFormat,
		},
		ForceAuthn: sp.ForceAuthn,
	}
	return &req, nil
}
398693
static public String getBasicAuthUsername(HttpServletRequest request){
		String[] userAndPassword = getBasicAuthUsernameAndPassword(request);
		return userAndPassword == null || userAndPassword.length == 0 ? null : userAndPassword[0];
	}
684318
public String id(){
        HttpServletRequest r = RequestContext.getHttpRequest();
        if(r == null){
            return null;
        }
        HttpSession session = r.getSession(false);
        return session == null ? null : session.getId();
    }
1316437
public static Tag clientName(ClientRequest request) {
		String host = request.url().getHost();
		if (host == null) {
			return CLIENT_NAME_NONE;
		}
		return Tag.of("clientName", host);
	}
1365043
@Nullable
  public static String getHttpUserAgentStringFromRequest (@Nonnull final HttpServletRequest aHttpRequest)
  {
    // Use non-standard headers first
    String sUserAgent = aHttpRequest.getHeader (CHttpHeader.UA);
    if (sUserAgent == null)
    {
      sUserAgent = aHttpRequest.getHeader (CHttpHeader.X_DEVICE_USER_AGENT);
      if (sUserAgent == null)
        sUserAgent = aHttpRequest.getHeader (CHttpHeader.USER_AGENT);
    }
    return sUserAgent;
  }
653969
@Override
    public String authUserInfo() {
        if (this.username != null && this.password != null) {
            return this.username + ':' + this.password;
        }
        return null;
    }
927255
private ProviderSignInAttempt getProviderUserSignInAttempt(RequestAttributes request) {
		return (ProviderSignInAttempt)sessionStrategy.getAttribute(request, ProviderSignInAttempt.SESSION_ATTRIBUTE);
	}
463475
public String getRedirectUri(AccessTokenRequest request) {

		String redirectUri = request.getFirst("redirect_uri");

		if (redirectUri == null && request.getCurrentUri() != null && useCurrentUri) {
			redirectUri = request.getCurrentUri();
		}

		if (redirectUri == null && getPreEstablishedRedirectUri() != null) {
			// Override the redirect_uri if it is pre-registered
			redirectUri = getPreEstablishedRedirectUri();
		}

		return redirectUri;

	}
471479
public GetVerifiedDomainResponse getVerifiedDomain(GetVerifiedDomainRequest request) {
        checkNotNull(request, "object request should not be null.");
        assertStringNotNullOrEmpty(request.getDomainName(), "object domainName should not be null or empty");

        InternalRequest internalRequest =
                this.createRequest("verifiedDomain", request, HttpMethodName.GET, request.getDomainName());
        return this.invokeHttpClient(internalRequest, GetVerifiedDomainResponse.class);
    }
1183886
private final String getIdAndName() {
        StringBuilder sb = new StringBuilder().append(id);
        if (identityName != null && identityName.length() > 0)
            sb.append(" (").append(identityName).append(')');
        return sb.toString();
    }
102963
public static String getRequestURI(HttpServletRequest httpRequest) {
        final StringBuilder url = new StringBuilder(100).append(httpRequest.getRequestURI());
        if (httpRequest.getQueryString() != null) {
            url.append('?').append(httpRequest.getQueryString());
        }

        return url.toString();
    }
651820
protected String getKeycloakUsername(final HttpServletRequest req, HttpServletResponse resp) {
        AtomicReference<String> username = new AtomicReference<>();
        Authenticator.authenticate(
            authConfiguration, req,
            subject -> {
                username.set(AuthHelpers.getUsername(subject));

                // Start httpSession
                req.getSession(true);
            }
        );
        return username.get();
    }