/*
(non-Javadoc)

@see com.ibm.ws.security.registry.UserRegistryService#getExternalUserRegistry(com.ibm.ws.security.registry.UserRegistry)
336792
@Override
    public com.ibm.websphere.security.UserRegistry getExternalUserRegistry(UserRegistry userRegistry) {
        if (userRegistry instanceof ExternalUserRegistryWrapper) {
            return ((ExternalUserRegistryWrapper) userRegistry).getExternalUserRegistry();
        }
        return new UserRegistryWrapper(userRegistry);
    }
187242
@Override
    public IPerson getCurrentPerson(final ExternalContext externalContext) {
        final HttpServletRequest servletRequest =
                getServletRequestFromExternalContext(externalContext);
        return personManager.getPerson(servletRequest);
    }
597204
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE, target = "(!(com.ibm.ws.security.registry.type=QuickStartSecurityRegistry))")
    protected synchronized void setUserRegistry(ServiceReference<UserRegistry> ref) {
        urs.add(ref);
        unregisterQuickStartSecurityRegistryConfiguration();
        unregisterQuickStartSecurityAdministratorRole();
    }
454042
@Override
    public void getUserSessionKey ( CIFSContext tc, byte[] chlng, byte[] dest, int offset ) throws SmbException {
        if ( this.hashesExternal ) {
            return;
        }
        super.getUserSessionKey(tc, chlng, dest, offset);
    }
536201
@Reference(cardinality = ReferenceCardinality.MULTIPLE,
               policyOption = ReferencePolicyOption.GREEDY)
    protected synchronized void setCustomUserRegistry(com.ibm.websphere.security.UserRegistry externalUserRegistry, Map<String, Object> props) {
        String id = getId(props);
        customUserRegistries.put(id, externalUserRegistry);
    }
288264
def user_by_external_id_and_provider(
        cls, external_id, provider_name, db_session=None
    ):
        
        db_session = get_db_session(db_session)
        query = db_session.query(cls.models_proxy.User)
        query = query.filter(cls.model.external_id == external_id)
        query = query.filter(cls.model.provider_name == provider_name)
        query = query.filter(cls.models_proxy.User.id == cls.model.local_user_id)
        return query.first()
1185918
private String getUserAccessId(String userName) {

        try {
            SecurityService securityService = securityServiceRef.getService();
            UserRegistryService userRegistryService = securityService.getUserRegistryService();
            UserRegistry userRegistry = userRegistryService.getUserRegistry();
            String realm = userRegistry.getRealm();
            String uniqueId = userRegistry.getUniqueUserId(userName);
            return AccessIdUtil.createAccessId(AccessIdUtil.TYPE_USER, realm, uniqueId);
        } catch (EntryNotFoundException e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Caught exception getting the access id for "
                             + userName + ": " + e);
            }
        } catch (RegistryException e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Caught exception getting the access id for "
                             + userName + ": " + e);
            }
        }
        return null;
    }
553012
@SuppressWarnings("unchecked")
    @Override
	public <T extends ApiUser> T getUserByName(String username) {
	    User sfsUser = getZone().getUserByName(username);
        if(sfsUser != null && sfsUser.containsProperty(APIKey.USER))
            return (T) sfsUser.getProperty(APIKey.USER);
        return null;
	}
1070115
protected static function getRegistry()
    {
        if (self::$registry === null) {
            self::$registry = Doozr_Registry::getInstance();
        }

        return self::$registry;
    }
260871
public static UserProfile getUserProfile() {
        UserProfile userProfile = null;
        Subject subject = getSubject();
        Iterator<UserProfile> userProfilesIterator = subject.getPrivateCredentials(UserProfile.class).iterator();
        if (userProfilesIterator.hasNext()) {
            userProfile = userProfilesIterator.next();
        }
        return userProfile;
    }
227639
@Override
  public UserGroupInformation getProxiedUser(final Props userProp)
      throws HadoopSecurityManagerException {
    final String userToProxy = verifySecureProperty(userProp, JobProperties.USER_TO_PROXY);
    final UserGroupInformation user = getProxiedUser(userToProxy);
    if (user == null) {
      throw new HadoopSecurityManagerException(
          "Proxy as any user in unsecured grid is not supported!");
    }
    return user;
  }
156874
public static Registry getRegistry()
   throws RemoteException
	{
			return LocateRegistry.getRegistry(Config.getProperty(RMI.class,"host"), 
												Config.getPropertyInteger(RMI.class,"port").intValue());
	}
288516
@Override
    public IUserInstance getUserInstance(HttpServletRequest request) throws PortalException {
        try {
            request = this.portalRequestUtils.getOriginalPortalRequest(request);
        } catch (IllegalArgumentException iae) {
            // ignore, just means that this isn't a wrapped request
        }

        // Use request attributes first for the fastest possible retrieval
        IUserInstance userInstance = (IUserInstance) request.getAttribute(KEY);
        if (userInstance != null) {
            return userInstance;
        }

        final IPerson person;
        try {
            // Retrieve the person object that is associated with the request
            person = this.personManager.getPerson(request);
        } catch (Exception e) {
            logger.error("Exception while retrieving IPerson!", e);
            throw new PortalSecurityException("Could not retrieve IPerson", e);
        }

        if (person == null) {
            throw new PortalSecurityException(
                    "PersonManager returned null person for this request.  With no user, there's no UserInstance.  Is PersonManager misconfigured?  RDBMS access misconfigured?");
        }

        final HttpSession session = request.getSession();
        if (session == null) {
            throw new IllegalStateException(
                    "HttpServletRequest.getSession() returned a null session for request: "
                            + request);
        }

        // Return the UserInstance object if it's in the session
        UserInstanceHolder userInstanceHolder = getUserInstanceHolder(session);
        if (userInstanceHolder != null) {
            userInstance = userInstanceHolder.getUserInstance();

            if (userInstance != null) {
                return userInstance;
            }
        }

        // Create either a UserInstance or a GuestUserInstance
        final LocaleManager localeManager = this.getLocaleManager(request, person);
        final String userAgent = this.getUserAgent(request);
        final IUserProfile userProfile =
                this.getUserProfile(request, person, localeManager, userAgent);

        // Create the user layout manager and user instance object
        IUserLayoutManager userLayoutManager =
                userLayoutManagerFactory.getUserLayoutManager(person, userProfile);

        final UserPreferencesManager userPreferencesManager =
                new UserPreferencesManager(person, userProfile, userLayoutManager);
        userInstance = new UserInstance(person, userPreferencesManager, localeManager);

        // Ensure the newly created UserInstance is cached in the session
        if (userInstanceHolder == null) {
            userInstanceHolder = new UserInstanceHolder();
        }
        userInstanceHolder.setUserInstance(userInstance);
        session.setAttribute(KEY, userInstanceHolder);
        request.setAttribute(KEY, userInstance);

        // Return the new UserInstance
        return userInstance;
    }
704387
@Override
    public Object getUserMetaData() {
        if (serializedUserMetaData != null) {
            try {
                userMetaData = SerializationUtility.deserialize(serializedUserMetaData, cacheName);
            } catch (Exception ex) {
                com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.CacheEntry.getUserMetaData", "600", this);
            }
            serializedUserMetaData = null;
        }
        return userMetaData;
    }
1315238
protected AuthenticationContext getAuthenticationContext(ProfileRequestContext<?, ?> context)
      throws ExternalAutenticationErrorCodeException {
    AuthenticationContext authnContext = authenticationContextLookupStrategy.apply(context);
    if (authnContext == null) {
      log.error("No AuthenticationContext available [{}]", this.getLogString(context));
      throw new ExternalAutenticationErrorCodeException(AuthnEventIds.INVALID_AUTHN_CTX, "Missing AuthenticationContext");
    }
    return authnContext;
  }
116437
public PropertyOwner retrieveUserProperties(String strRegistrationKey)
    {
        if (this.getTask() != null)
        {
            if (this.getTask() instanceof PropertyOwner)
                return ((PropertyOwner)this.getTask()).retrieveUserProperties(strRegistrationKey);  // Try task
            if (this.getTask().getApplication() != null)
                return this.getTask().getApplication().retrieveUserProperties(strRegistrationKey);  // Try app
        }
        return null;    // Not found
    }
12567
private static ActionRegistry getRegistry(boolean global) {
        if (global) {
            return instance;
        }
        
        Page page = ExecutionContext.getPage();
        ActionRegistry registry = (ActionRegistry) page.getAttribute(ATTR_LOCAL_REGISTRY);
        
        if (registry == null) {
            page.setAttribute(ATTR_LOCAL_REGISTRY, registry = new ActionRegistry());
        }
        
        return registry;
    }