Returns Authenticator type

@param loginInput login information
@return Authenticator type
191776
static private ClientAuthnDTO.AuthenticatorType getAuthenticator(
      LoginInput loginInput)
  {
    if (loginInput.getAuthenticator() != null)
    {
      if (loginInput.getAuthenticator().equalsIgnoreCase(
          ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER.name()))
      {
        // SAML 2.0 compliant service/application
        return ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER;
      }
      else if (loginInput.getAuthenticator().equalsIgnoreCase(
          ClientAuthnDTO.AuthenticatorType.OAUTH.name()))
      {
        // OAuth Authentication
        return ClientAuthnDTO.AuthenticatorType.OAUTH;
      }
      else if (loginInput.getAuthenticator().equalsIgnoreCase(
          ClientAuthnDTO.AuthenticatorType.SNOWFLAKE_JWT.name()))
      {
        return ClientAuthnDTO.AuthenticatorType.SNOWFLAKE_JWT;
      }
      else if (!loginInput.getAuthenticator().equalsIgnoreCase(
          ClientAuthnDTO.AuthenticatorType.SNOWFLAKE.name()))
      {
        // OKTA authenticator v1. This will be deprecated once externalbrowser
        // is in production.
        return ClientAuthnDTO.AuthenticatorType.OKTA;
      }
    }

    // authenticator is null, then jdbc will decide authenticator depends on
    // if privateKey is specified or not. If yes, authenticator type will be
    // SNOWFLAKE_JWT, otherwise it will use SNOWFLAKE.
    return loginInput.getPrivateKey() != null ?
           ClientAuthnDTO.AuthenticatorType.SNOWFLAKE_JWT :
           ClientAuthnDTO.AuthenticatorType.SNOWFLAKE;
  }
1160429
private void handleAuthenticationType(final Object authenticationType) {
		if (request != null) {
			if (authenticationType != null) {
				// be defensive
				if (!(authenticationType instanceof String)) {
					final String message = "Attribute "
							+ HttpContext.AUTHENTICATION_TYPE
							+ " expected to be a String but was an ["
							+ authenticationType.getClass() + "]";
					LOG.error(message);
					throw new IllegalArgumentException(message);
				}
			}
			getOsgiAuth().setAuthMethod((String) authenticationType);
		} else {
			LOG.warn("Authentication type cannot be set to "
					+ authenticationType
					+ ". HttpService specific authentication is disabled because the ServletRequest object cannot be used: "
					+ "Expected to be an instance of "
					+ Request.class.getName() + " but got "
					+ originalRequest.getClass().getName() + ".");
		}
	}
938750
public final ConversationState authenticate(Credentials credentials) throws LoginException
   {

      CredentialsImpl thisCredentials;
      if (credentials instanceof CredentialsImpl)
      {
         thisCredentials = (CredentialsImpl)credentials;
      }
      else if (credentials instanceof SimpleCredentials)
      {
         String name = ((SimpleCredentials)credentials).getUserID();
         char[] pswd = ((SimpleCredentials)credentials).getPassword();
         thisCredentials = new CredentialsImpl(name, pswd);
      }
      else
         throw new LoginException(
            "Credentials for the authentication should be CredentialsImpl or SimpleCredentials type");

      // SYSTEM
      if (thisCredentials.getUserID().equals(IdentityConstants.SYSTEM))
      {
         Identity sid = new Identity(IdentityConstants.SYSTEM, new HashSet<MembershipEntry>());
         return new ConversationState(sid);
      }

      // prepare to new login
      // uses BasicCallbackHandler
      CallbackHandler handler = new BasicCallbackHandler(thisCredentials.getUserID(), thisCredentials.getPassword());

      // and try to login
      try
      {

         LoginContext loginContext = new LoginContext(config.getSecurityDomain(), handler);
         loginContext.login();

      }
      catch (javax.security.auth.login.LoginException e)
      {
         throw new LoginException("Login failed for " + thisCredentials.getUserID() + " " + e);
      }

      if (log.isDebugEnabled())
         log.debug("Logged " + thisCredentials.getUserID());

      // supposed to be set
      Identity identity = identityRegistry.getIdentity(thisCredentials.getUserID());
      if (identity == null)
      {
         throw new LoginException("Identity not found, check Loginmodule, userId " + thisCredentials.getUserID());
      }
      ConversationState state = new ConversationState(identity);
      String[] aNames = thisCredentials.getAttributeNames();
      for (String name : aNames)
      {
         state.setAttribute(name, thisCredentials.getAttribute(name));
      }

      ConversationState.setCurrent(state);
      return state;

   }
1035752
public static ApiDynamicActionImplementor getSetCredentialsForUserApiAction(
			final AuthenticationMethodType methodType) {
		return new ApiDynamicActionImplementor(ACTION_SET_CREDENTIALS, new String[] { PARAM_USERNAME,
				PARAM_PASSWORD }, null) {

			@Override
			public void handleAction(JSONObject params) throws ApiException {
				Context context = ApiUtils.getContextByParamId(params, UsersAPI.PARAM_CONTEXT_ID);
				int userId = ApiUtils.getIntParam(params, UsersAPI.PARAM_USER_ID);
				// Make sure the type of authentication method is compatible
				if (!methodType.isTypeForMethod(context.getAuthenticationMethod()))
					throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER,
							"User's credentials should match authentication method type of the context: "
									+ context.getAuthenticationMethod().getType().getName());

				// NOTE: no need to check if extension is loaded as this method is called only if
				// the Users
				// extension is loaded
				ExtensionUserManagement extensionUserManagement = Control
						.getSingleton().getExtensionLoader().getExtension(ExtensionUserManagement.class);
				User user = extensionUserManagement.getContextUserAuthManager(context.getIndex())
						.getUserById(userId);
				if (user == null)
					throw new ApiException(ApiException.Type.USER_NOT_FOUND, UsersAPI.PARAM_USER_ID);
				// Build and set the credentials
				UsernamePasswordAuthenticationCredentials credentials = new UsernamePasswordAuthenticationCredentials();
				credentials.username = ApiUtils.getNonEmptyStringParam(params, PARAM_USERNAME);
				credentials.password = ApiUtils.getNonEmptyStringParam(params, PARAM_PASSWORD);
				user.setAuthenticationCredentials(credentials);
			}
		};
	}
161506
@Override
  public ExtensionProcessor getLoginProcessor()
  {
      //do not cache the processor in the webcontainer code, always return the result from security
      IWebAppSecurityCollaborator secCollab = this.collabHelper.getSecurityCollaborator();
      loginProcessor = secCollab.getFormLoginExtensionProcessor(this);
      return loginProcessor;
  }
1134646
public boolean isSameType(AuthenticationMethod other) {
		if (other == null)
			return false;
		return other.getClass().equals(this.getClass());
	}
210979
public String getAuthType()
    {
        if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
            checkRequestObjectInUse();
        }
        String authType = null;

        //if (com.ibm.ws.security.core.SecurityContext.isSecurityEnabled())
        if(((WebAppDispatcherContext)this.getDispatchContext()).isSecurityEnabledForApplication())
        {
            authType = (String) getPrivateAttribute("AUTH_TYPE");
        }
        else
        {
            authType = _request.getAuthType();
        }
        //321485
        if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
            logger.logp(Level.FINE, CLASS_NAME,"getAuthType", " authType --> " + authType);
        }
        // return one of the static vars defined in HttpServletRequest
        if (authType != null)
        {
            if (authType.equals("BASIC"))
                return HttpServletRequest.BASIC_AUTH;
            else if (authType.equals("CLIENT_CERT"))
                return HttpServletRequest.CLIENT_CERT_AUTH;
            else if (authType.equals("DIGEST"))
                return HttpServletRequest.DIGEST_AUTH;
            else if (authType.equals("FORM"))
                return HttpServletRequest.FORM_AUTH;
        }

        return authType;
    }
851600
public static Authentication getInProgressAuthentication() {
        val context = RequestContextHolder.getRequestContext();
        val authentication = context != null ? WebUtils.getAuthentication(context) : null;
        if (authentication == null) {
            return AuthenticationCredentialsThreadLocalBinder.getInProgressAuthentication();
        }
        return authentication;
    }
137047
@Override
	public AuthenticationManager getAuthenticationManager() {
        if(ValkyrieRepository.getInstance().getApplicationConfig().applicationContext().getBeansOfType(AuthenticationManager.class).size() != 0)
		    return ValkyrieRepository.getInstance().getBean(AuthenticationManager.class);
        else {
            return null;
        }

	}
1170045
public static Authentication getAuthentication() {
        SecurityContext sc = getSecurityContext();
        return sc == null ? null : sc.getAuthentication();
    }
908822
def authenticationResponse():
    """"""
    a = TpPd(pd=0x5)
    b = MessageType(mesType=0x14)  # 00010100
    c = AuthenticationParameterSRES()
    packet = a / b / c
    return packet
718052
public static Authentication getCurrentAuthentication() {
        RequestContext context = RequestContext.getCurrent();
        if (context != null) {
            return getAuthentication(context.getRequest());
        } else {
            return null;
        }
    }
1211145
static String getUserIdentifier(IoSession session) {
        boolean isAcceptor = isAcceptor(session);
        SocketAddress hostPortAddress = isAcceptor ? session.getRemoteAddress() : session.getLocalAddress();
        SocketAddress identityAddress = isAcceptor ? session.getLocalAddress() : session.getRemoteAddress();
        String identity = resolveIdentity(identityAddress, (IoSessionEx)session);
        String hostPort = getHostPort(hostPortAddress);
        return identity == null ? hostPort : format("%s %s", identity, hostPort);
    }
4520
def get_auth_instance(credentials, auth_type):
    
    model = AUTH_TYPE_MAP[auth_type]
    if model is None:
        return None
    username = credentials.username
    if auth_type == NTLM and credentials.type == credentials.EMAIL:
        username = '\\' + username
    if auth_type == GSSAPI:
        # Kerberos auth relies on credentials supplied via a ticket available externally to this library
        return model()
    return model(username=username, password=credentials.password)
626092
public TProcessorFactory getAuthProcFactory(ThriftCLIService service) throws LoginException {
    if (authTypeStr.equalsIgnoreCase(AuthTypes.KERBEROS.getAuthName())) {
      return KerberosSaslHelper.getKerberosProcessorFactory(saslServer, service);
    } else {
      return PlainSaslHelper.getPlainProcessorFactory(service);
    }
  }
481671
public LoginConfigType<WebAppType<T>> getOrCreateLoginConfig()
   {
      List<Node> nodeList = childNode.get("login-config");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new LoginConfigTypeImpl<WebAppType<T>>(this, "login-config", childNode, nodeList.get(0));
      }
      return createLoginConfig();
   }
1246798
@NonNull
    public ReplicatorConfiguration setAuthenticator(@NonNull Authenticator authenticator) {
        if (readonly) { throw new IllegalStateException("ReplicatorConfiguration is readonly mode."); }
        this.authenticator = authenticator;
        return getReplicatorConfiguration();
    }