Get auth

If no auth has been set, this method will
set and return a default auth, if any such
value is available

@see getDefaultAuth()

@return Guard|null auth or null if none auth has been set
968775
public function getAuth(): ?Guard
    {
        if (!$this->hasAuth()) {
            $this->setAuth($this->getDefaultAuth());
        }
        return $this->auth;
    }
207351
protected function getAuthenticationService()
    {
        if ($this->authenticationService === null) {
            $this->authenticationService = new AuthenticationService($this->getStorage());
        }
        
        return $this->authenticationService;
    }
429546
public function guarded($guard = null)
	{
		if(!$this->isAuthGuarded())
		{
			if(is_null($guard))
				$guard = $this->guard;

			$this->user = $this->users()->findOrFail(Auth::guard($guard)->user()->id);
		}

		return $this;
	}
948967
public function getAuthManager(): ?AuthManager
    {
        if (!$this->hasAuthManager()) {
            $this->setAuthManager($this->getDefaultAuthManager());
        }
        return $this->authManager;
    }
219752
protected function getAuth()
    {
        if (is_null($this->auth)) {
            $this->auth = app($this->config('auth'));
        }

        return $this->auth;
    }
800740
public function ifGuest($guard = null)
    {
        $this->hideCallbacks->push(function () use ($guard) {
            return auth()->guard($guard)->user();
        });

        return $this;
    }
173713
protected function getAuthForLogin()
	{
		// If a "key" was specified in the auth credentials, we will load it into a
		// secure RSA key instance, which will be used to connect to the servers
		// in place of a password, and avoids the developer specifying a pass.
		if ($this->hasRsaKey())
		{
			return $this->loadRsaKey($this->auth);
		}

		// If a plain password was set on the auth credentials, we will just return
		// that as it can be used to connect to the server. This will be used if
		// there is no RSA key and it gets specified in the credential arrays.
		elseif (isset($this->auth['password']))
		{
			return $this->auth['password'];
		}

		throw new \InvalidArgumentException('Password / key is required.');
	}
52334
public function authenticate()
	{
		// Already got some credentials stored?
		if ($this->token)
		{
			$response = $this->verifyCredentials();

			if ($response)
			{
				return $this->token;
			}

			$this->token = null;
		}

		// Check for callback.
		if (strcmp($this->version, '1.0a') === 0)
		{
			$verifier = $this->input->get('oauth_verifier');
		}
		else
		{
			$verifier = $this->input->get('oauth_token');
		}

		if (empty($verifier))
		{
			// Generate a request token.
			$this->generateRequestToken();

			// Authenticate the user and authorise the app.
			$this->authorise();
		}

		// Callback
		else
		{
			$session = $this->application->getSession();

			// Get token form session.
			$this->token = array('key' => $session->get('oauth_token.key', null), 'secret' => $session->get('oauth_token.secret', null));

			// Verify the returned request token.
			if (strcmp($this->token['key'], $this->input->get('oauth_token')) !== 0)
			{
				throw new \DomainException('Bad session!');
			}

			// Set token verifier for 1.0a.
			if (strcmp($this->version, '1.0a') === 0)
			{
				$this->token['verifier'] = $this->input->get('oauth_verifier');
			}

			// Generate access token.
			$this->generateAccessToken();

			// Return the access token.
			return $this->token;
		}
	}
1170075
public function getProxyAuth()
    {
        $proxy_options = $this->getOption(EnumRequestOption::PROXY_OPTIONS, []);
        return isset($proxy_options[EnumProxyOption::PROXY_AUTH]) ? $proxy_options[EnumProxyOption::PROXY_AUTH] : null;
    }
441510
public function getOAuthToken()
    {
        if (!$this->isStateless()) {
            return \Cache::get('oauth.temp');
        } else {
            /** @var TemporaryCredentials $temp */
            $temp = unserialize(\Cache::get('oauth_temp'));

            return $temp->getIdentifier();
        }
    }
146626
protected function authenticate()
    {
        $authClass = $this->config()->authenticator;
        $member = $authClass::authenticate();
        Security::setCurrentUser($member);
        return $member;
    }
324724
public function seeAuthentication($guard = null)
    {
        $auth = $this->app['auth'];

        if (method_exists($auth, 'guard')) {
            $auth = $auth->guard($guard);
        }

        $this->assertTrue($auth->check(), 'There is no authenticated user');
    }
505205
public function getAuthFactory(): ?Factory
    {
        if (!$this->hasAuthFactory()) {
            $this->setAuthFactory($this->getDefaultAuthFactory());
        }
        return $this->authFactory;
    }
593243
protected function getAuth()
    {
        if (isset($this->auth['username']) && isset($this->auth['password'])) {
            return [$this->auth['username'], $this->auth['password']];
        }
    }
434848
public function getLocaleFromAuthenticatedUser()
    {

        $user = $this->findAuthenticatedUser();

        return (null !== $user && $user->getLocale()) ? $user->getLocale() : 'es';
    }
892001
private function getSecurityToken()
    {
        if ($this->container->get('security.context')->getToken() instanceof TokenInterface) {
            return $this->container->get('security.context')->getToken();
        }

        return null;
    }
1337357
public function getOAuthToken()
    {
        // If any of the required fields are empty, return null.
        $hasAnEmptyField = empty($this->northstar_id) || empty($this->access_token) ||
            empty($this->access_token_expiration) || empty($this->refresh_token) || empty($this->role);

        if ($hasAnEmptyField) {
            return null;
        }

        return new AccessToken([
            'resource_owner_id' => $this->getNorthstarIdentifier(),
            'access_token' => $this->access_token,
            'refresh_token' => $this->refresh_token,
            'expires' => $this->access_token_expiration,
            'role' => $this->role,
        ]);
    }