protected function handlePOST()
    {
        $serviceName = $this->getOAuthServiceName();

        if (empty($serviceName)) {
            $credentials = [
                'email'        => $this->getPayloadData('email'),
                'username'     => $this->getPayloadData('username'),
                'password'     => $this->getPayloadData('password'),
                'is_sys_admin' => false
            ];

            return $this->handleLogin($credentials, boolval($this->getPayloadData('remember_me')));
        }

        /** @type ADLdap $service */
        $service = ServiceManager::getService($serviceName);
        $serviceGroup = $service->getServiceTypeInfo()->getGroup();

        switch ($serviceGroup) {
            case ServiceTypeGroups::LDAP:
                if (
                    config('df.enable_windows_auth', false) === true &&
                    $service->getServiceTypeInfo()->getName() === 'adldap'
                ) {
                    // get windows authenticated user
                    $username = array_get($_SERVER, 'LOGON_USER', array_get($_SERVER, 'REMOTE_USER'));
                    if (!empty($username)) {
                        return $service->handleWindowsAuth($username);
                    }
                }

                $credentials = [
                    'username' => $this->getPayloadData('username'),
                    'password' => $this->getPayloadData('password')
                ];

                return $service->handleLogin($credentials, $this->getPayloadData('remember_me'));
            case ServiceTypeGroups::OAUTH:
                $oauthCallback = $this->request->getParameterAsBool('oauth_callback');

                /** @type BaseOAuthService $service */
                if (!empty($oauthCallback)) {
                    return $service->handleOAuthCallback();
                } else {
                    return $service->handleLogin($this->request->getDriver());
                }
            default:
                throw new BadRequestException('Invalid login service provided. Please use an OAuth or AD/Ldap service.');
        }
    }
protected function handlePOST()
    {
        $serviceName = $this->getOAuthServiceName();

        if (empty($serviceName)) {
            $credentials = [
                'email'        => $this->getPayloadData('email'),
                'username'     => $this->getPayloadData('username'),
                'password'     => $this->getPayloadData('password'),
                'is_sys_admin' => false
            ];

            return $this->handleLogin($credentials, boolval($this->getPayloadData('remember_me')));
        }

        /** @type ADLdap $service */
        $service = ServiceManager::getService($serviceName);
        $serviceGroup = $service->getServiceTypeInfo()->getGroup();

        switch ($serviceGroup) {
            case ServiceTypeGroups::LDAP:
                if (
                    config('df.enable_windows_auth', false) === true &&
                    $service->getServiceTypeInfo()->getName() === 'adldap'
                ) {
                    // get windows authenticated user
                    $username = array_get($_SERVER, 'LOGON_USER', array_get($_SERVER, 'REMOTE_USER'));
                    if (!empty($username)) {
                        return $service->handleWindowsAuth($username);
                    }
                }

                $credentials = [
                    'username' => $this->getPayloadData('username'),
                    'password' => $this->getPayloadData('password')
                ];

                return $service->handleLogin($credentials, $this->getPayloadData('remember_me'));
            case ServiceTypeGroups::OAUTH:
                $oauthCallback = $this->request->getParameterAsBool('oauth_callback');

                /** @type BaseOAuthService $service */
                if (!empty($oauthCallback)) {
                    return $service->handleOAuthCallback();
                } else {
                    return $service->handleLogin($this->request->getDriver());
                }
            default:
                throw new BadRequestException('Invalid login service provided. Please use an OAuth or AD/Ldap service.');
        }
    }
protected function handlePOST ( ) { $ serviceName = $ this -> getOAuthServiceName ( ) ; if ( empty ( $ serviceName ) ) { $ credentials = [ 'email' => $ this -> getPayloadData ( 'email' ) , 'username' => $ this -> getPayloadData ( 'username' ) , 'password' => $ this -> getPayloadData ( 'password' ) , 'is_sys_admin' => false ] ; return $ this -> handleLogin ( $ credentials , boolval ( $ this -> getPayloadData ( 'remember_me' ) ) ) ; } /** @type ADLdap $service */ $ service = ServiceManager :: getService ( $ serviceName ) ; $ serviceGroup = $ service -> getServiceTypeInfo ( ) -> getGroup ( ) ; switch ( $ serviceGroup ) { case ServiceTypeGroups :: LDAP : if ( config ( 'df.enable_windows_auth' , false ) === true && $ service -> getServiceTypeInfo ( ) -> getName ( ) === 'adldap' ) { // get windows authenticated user $ username = array_get ( $ _SERVER , 'LOGON_USER' , array_get ( $ _SERVER , 'REMOTE_USER' ) ) ; if ( ! empty ( $ username ) ) { return $ service -> handleWindowsAuth ( $ username ) ; } } $ credentials = [ 'username' => $ this -> getPayloadData ( 'username' ) , 'password' => $ this -> getPayloadData ( 'password' ) ] ; return $ service -> handleLogin ( $ credentials , $ this -> getPayloadData ( 'remember_me' ) ) ; case ServiceTypeGroups :: OAUTH : $ oauthCallback = $ this -> request -> getParameterAsBool ( 'oauth_callback' ) ; /** @type BaseOAuthService $service */ if ( ! empty ( $ oauthCallback ) ) { return $ service -> handleOAuthCallback ( ) ; } else { return $ service -> handleLogin ( $ this -> request -> getDriver ( ) ) ; } default : throw new BadRequestException ( 'Invalid login service provided. Please use an OAuth or AD/Ldap service.' ) ; } }
Authenticates valid user.

@return array
@throws \DreamFactory\Core\Exceptions\BadRequestException
@throws \DreamFactory\Core\Exceptions\UnauthorizedException
Authenticates valid user .