<commit_before><?php

namespace DreamFactory\Core\OAuth\Resources;

use DreamFactory\Core\Resources\BaseRestResource;

class SSO extends BaseRestResource
{
    /** Resource name */
    const RESOURCE_NAME = 'sso';

    /** Resource Identifier */
    const RESOURCE_IDENTIFIER = 'name';

    /**
     * {@inheritdoc}
     */
    protected static function getResourceIdentifier()
    {
        return static::RESOURCE_IDENTIFIER;
    }

    /** {@inheritdoc} */
    protected function handlePOST()
    {
        $payload = $this->request->getPayloadData();
        /** @var $provider \DreamFactory\Core\OAuth\Components\DfOAuthTwoProvider */
        $provider = $this->getParent()->getProvider();
        $user = $provider->getUserFromTokenResponse($payload);

        return $this->getParent()->loginOAuthUser($user);
    }

    /** {@inheritdoc} */
    protected function getApiDocPaths()
    {
        $resourceName = strtolower($this->name);
        $path = '/' . $resourceName;
        $base = [
            $path => [
                'post' => [
                    'summary'     => 'performSSO() - Single Sign On',
                    'operationId' => 'performSSO',
                    'description' => 'Performs Single Sign On using OAuth 2.0 access token',
                    'requestBody' => [
                        'description' => 'Content - OAuth token response',
                        'schema'      => [
                            'type'       => 'object',
                            'required'   => ['access_token', 'token_type'],
                            'properties' => [
                                'access_token'  => [
                                    'type'        => 'string',
                                    'description' => 'The access token issued by the authorization server.'
                                ],
                                'token_type'    => [
                                    'type'        => 'string',<commit_msg>Fix OpenAPI spec output<commit_after><?php

namespace DreamFactory\Core\OAuth\Resources;

use DreamFactory\Core\Resources\BaseRestResource;

class SSO extends BaseRestResource
{
    /** Resource name */
    const RESOURCE_NAME = 'sso';

    /** Resource Identifier */
    const RESOURCE_IDENTIFIER = 'name';

    /**
     * {@inheritdoc}
     */
    protected static function getResourceIdentifier()
    {
        return static::RESOURCE_IDENTIFIER;
    }

    /** {@inheritdoc} */
    protected function handlePOST()
    {
        $payload = $this->request->getPayloadData();
        /** @var $provider \DreamFactory\Core\OAuth\Components\DfOAuthTwoProvider */
        $provider = $this->getParent()->getProvider();
        $user = $provider->getUserFromTokenResponse($payload);

        return $this->getParent()->loginOAuthUser($user);
    }

    /** {@inheritdoc} */
    protected function getApiDocPaths()
    {
        $resourceName = strtolower($this->name);
        $path = '/' . $resourceName;
        $service = $this->getServiceName();
        $capitalized = camelize($service);
        $class = trim(strrchr(static::class, '\\'), '\\');

        $base = [
            $path => [
                'post' => [
                    'summary'     => 'perform' . $capitalized . $class . 'SSO() - Single Sign On',
                    'operationId' => 'perform' . $capitalized . $class . 'SSO',
                    'description' => 'Performs Single Sign On using OAuth 2.0 access token',
                    'requestBody' => [
                        'description' => 'Content - OAuth token response',
                        'schema'      => [
                            'type'       => 'object',
                            'required'   => ['access_token', 'token_type'],
                            'properties' => [
                                'access_token'  => [
                                    'type'        => 'string',
                                    'description' => 'The access token issued by the authorization server.'
                                ],
                                'token_type'    => [
                                    'type'        => 'string',
{'fraction_non_alphanumeric': 0.13226500837120306, 'fraction_numerical': 0.0009567089213106913, 'mean_word_length': 1.461447910535609, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 52, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5248102', 'n_tokens_mistral': 1076, 'n_tokens_neox': 1038, 'n_words': 208}