/*
(non-Javadoc)

@see com.ibm.ws.webcontainer.webapp.WebApp#getLoginProcessor()
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;
  }
321614
public java.security.Principal getUserPrincipal()
    {
        if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
            checkRequestObjectInUse();
        }
        IWebAppSecurityCollaborator webAppSec=null;
        if (getDispatchContext()!=null && getDispatchContext().getWebApp() != null) {
            webAppSec = CollaboratorHelperImpl.getCurrentSecurityCollaborator(getDispatchContext().getWebApp());
        } else {
            webAppSec = CollaboratorHelperImpl.getCurrentSecurityCollaborator();           
        } 
            
        if (webAppSec != null) {
            if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){  //306998.15
                logger.logp(Level.FINE, CLASS_NAME,"getUserPrincipal", "calling getUserPrincipal on " + webAppSec.getClass().getName());
            }
            return webAppSec.getUserPrincipal();
        } else {
            if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){  //306998.15
                logger.logp(Level.FINE, CLASS_NAME,"getUserPrincipal", "returning null");
            }
            // No IWebAppSecurityCollaborator means no security, so no Principal 
            return null;
        }
    }
681069
@Override
    public Cache getSocialLoginCookieCache() {
        if (cache == null) {
            cache = new Cache(0, 0);
        }
        if (tc.isDebugEnabled()) {
            Tr.debug(tc, "socialLoginCockieCache cache:" + cache);
        }
        return cache;
    }
341685
@Override
    public ItemProcessor getProcessor(Item item) {
        for (Map.Entry<String, ItemProcessor> mapping : patternToProcessorMappings.entrySet()) {
            if (item.getUrl().matches(mapping.getKey())) {
                return mapping.getValue();
            }
        }

        return null;
    }
1251136
private LoginContext getClientLoginContext() throws LoginException {
        Configuration config = new Configuration() {
            @Override
            public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
                Map<String, String> options = new HashMap<String, String>();
                options.put("multi-threaded", "true");
                options.put("restore-login-identity", "true");

                AppConfigurationEntry clmEntry = new AppConfigurationEntry(ClientLoginModule.class.getName(), LoginModuleControlFlag.REQUIRED, options);
                return new AppConfigurationEntry[] { clmEntry };
            }
        };
        return getLoginContext(config);
    }
1212328
private CertificateAuthenticator getCertificateAuthenticator(X509Certificate[] certChain) throws LoginException {
        CertificateAuthenticator certAuthen = null;
        ConcurrentServiceReferenceMap<String, CertificateAuthenticator> certAuthens = JAASServiceImpl.getCertificateAuthenticators();
        Set<String> keys = certAuthens.keySet();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "CertificateAuthenticator keys:", keys);
        }
        // Iterate through the CertificateAuthenticators and call
        // authenticateCertificateChain. Return the 1st one to return true.
        for (String key : keys) {
            CertificateAuthenticator current = certAuthens.getService(key);
            if (current.authenticateCertificateChain(certChain)) {
                certAuthen = current;
                break;
            }
        }
        return certAuthen;
    }
634035
public static LoggingSystem get(ClassLoader classLoader) {
		String loggingSystem = System.getProperty(SYSTEM_PROPERTY);
		if (StringUtils.hasLength(loggingSystem)) {
			if (NONE.equals(loggingSystem)) {
				return new NoOpLoggingSystem();
			}
			return get(classLoader, loggingSystem);
		}
		return SYSTEMS.entrySet().stream()
				.filter((entry) -> ClassUtils.isPresent(entry.getKey(), classLoader))
				.map((entry) -> get(classLoader, entry.getValue())).findFirst()
				.orElseThrow(() -> new IllegalStateException(
						"No suitable logging system located"));
	}
475313
@Deprecated
    public JsEngineComponent getMessageProcessor(String name) {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, "getMessageProcessor", this);
            SibTr.exit(tc, "getMessageProcessor", _messageProcessor);
        }

        return _messageProcessor;
    }
611297
protected InvokerExtensionProcessor getInvokerExtensionProcessor(com.ibm.ws.webcontainer.webapp.WebApp app)
  {
    return new com.ibm.ws.webcontainer.osgi.extension.InvokerExtensionProcessor(app, config.getInvokerAttributes());
  }
1180794
@Override
    public LoginCredential getLoginCredential() {
        return LaRequestUtil
                .getOptionalRequest()
                .map(request -> {
                    final HttpServletResponse response = LaResponseUtil.getResponse();
                    final SpnegoHttpServletResponse spnegoResponse = new SpnegoHttpServletResponse(response);

                    // client/caller principal
                    final SpnegoPrincipal principal;
                    try {
                        principal = getAuthenticator().authenticate(request, spnegoResponse);
                    } catch (final Exception e) {
                        final String msg = "HTTP Authorization Header=" + request.getHeader(Constants.AUTHZ_HEADER);
                        if (logger.isDebugEnabled()) {
                            logger.debug(msg);
                        }
                        throw new SsoLoginException(msg, e);
                    }

                    // context/auth loop not yet complete
                    if (spnegoResponse.isStatusSet()) {
                        return new ActionResponseCredential(() -> {
                            throw new RequestLoggingFilter.RequestClientErrorException("Your request is not authorized.",
                                    "401 Unauthorized", HttpServletResponse.SC_UNAUTHORIZED);
                        });
                    }

                    // assert
                    if (null == principal) {
                        final String msg = "Principal was null.";
                        if (logger.isDebugEnabled()) {
                            logger.debug(msg);
                        }
                        throw new SsoLoginException(msg);
                    }

                    if (logger.isDebugEnabled()) {
                        logger.debug("principal=" + principal);
                    }

                    final String[] username = principal.getName().split("@", 2);
                    return new SpnegoCredential(username[0]);
                }).orElseGet(() -> null);

    }
1190348
def get_processor(self, entity_id, sp_config):
        
        processor_string = sp_config.get('processor', None)
        if processor_string:
            try:
                return import_string(processor_string)(entity_id)
            except Exception as e:
                logger.error("Failed to instantiate processor: {} - {}".format(processor_string, e), exc_info=True)
                raise
        return BaseProcessor(entity_id)
1132496
public static String getProcessId(final String fallback) {
        final String jvmName = ManagementFactory.getRuntimeMXBean().getName();
        final int index = jvmName.indexOf('@');
        if (index < 1) {
            return fallback;
        }
        try {
            return Long.toString(Long.parseLong(jvmName.substring(0, index)));
        }
        catch (NumberFormatException e) {
        }
        return fallback;
    }
1364290
public User getLoggedInUser() {
    User user = null;

    final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    if (authentication != null) {
      final Object principal = authentication.getPrincipal();

      // principal can be "anonymousUser" (String)
      if (principal instanceof UserDetails) {
        user = userDetailsConverter.convert((UserDetails) principal);
      }
    }
    return user;
  }
969497
public BuildLogger getLogger() {
    @SuppressWarnings("unchecked") final List<? extends BuildListener> listeners = getProject().getBuildListeners();
    assert listeners.size() > 0;
    return (BuildLogger)listeners.get(0);
  }
744564
public String getProcessInstanceId() {
    Execution execution = associationManager.getExecution();
    return execution != null ? execution.getProcessInstanceId() : null;
  }
570085
public com.google.appengine.v1.LoginRequirement getLogin() {
    com.google.appengine.v1.LoginRequirement result = com.google.appengine.v1.LoginRequirement.valueOf(login_);
    return result == null ? com.google.appengine.v1.LoginRequirement.UNRECOGNIZED : result;
  }
1327314
public static ProcessorActionHandler getHandler(ProcessorAction action) {
        ProcessorActionHandler ret = null;
        Class<? extends ProcessorActionHandler> cls = handlers.get(action.getClass());
        if (cls != null) {
            try {
                Constructor<? extends ProcessorActionHandler> con = cls.getConstructor(ProcessorAction.class);
                ret = con.newInstance(action);
            } catch (Exception e) {
                log.log(Level.SEVERE, "Failed to instantiate handler for action '" + action + "'", e);
            }
        }
        return ret;
    }