INTERNAL-Authorization

<back to all web services

AuthorizeTokenFast

Requires Authentication
The following routes are available for this service:
GET,POST/authorizetokenfast/{Service}/{TokenString}
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class AuthorizeFastBaseResponse implements JsonSerializable
{
    public function __construct(
        /** @var bool|null */
        public ?bool $isAuthorized=null,
        /** @var array<string,string>|null */
        public ?array $settings=null,
        /** @var int */
        public int $suggestedStatusCode=0,
        /** @var string|null */
        public ?string $suggestedResponseMessage=null,
        /** @var string|null */
        public ?string $reason=null,
        /** @var string|null */
        public ?string $customerId=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['isAuthorized'])) $this->isAuthorized = $o['isAuthorized'];
        if (isset($o['settings'])) $this->settings = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['settings']);
        if (isset($o['suggestedStatusCode'])) $this->suggestedStatusCode = $o['suggestedStatusCode'];
        if (isset($o['suggestedResponseMessage'])) $this->suggestedResponseMessage = $o['suggestedResponseMessage'];
        if (isset($o['reason'])) $this->reason = $o['reason'];
        if (isset($o['customerId'])) $this->customerId = $o['customerId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->isAuthorized)) $o['isAuthorized'] = $this->isAuthorized;
        if (isset($this->settings)) $o['settings'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->settings);
        if (isset($this->suggestedStatusCode)) $o['suggestedStatusCode'] = $this->suggestedStatusCode;
        if (isset($this->suggestedResponseMessage)) $o['suggestedResponseMessage'] = $this->suggestedResponseMessage;
        if (isset($this->reason)) $o['reason'] = $this->reason;
        if (isset($this->customerId)) $o['customerId'] = $this->customerId;
        return empty($o) ? new class(){} : $o;
    }
}

class AuthorizeTokenFastResponse extends AuthorizeFastBaseResponse implements JsonSerializable
{
    /**
     * @param bool|null $isAuthorized
     * @param array<string,string>|null $settings
     * @param int $suggestedStatusCode
     * @param string|null $suggestedResponseMessage
     * @param string|null $reason
     * @param string|null $customerId
     */
    public function __construct(
        ?bool $isAuthorized=null,
        ?array $settings=null,
        int $suggestedStatusCode=0,
        ?string $suggestedResponseMessage=null,
        ?string $reason=null,
        ?string $customerId=null
    ) {
        parent::__construct($isAuthorized,$settings,$suggestedStatusCode,$suggestedResponseMessage,$reason,$customerId);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

class AuthorizeTokenFast implements IAuthorizeToken, JsonSerializable
{
    public function __construct(
        // @ApiMember(IsRequired=true, ParameterType="path")
        /** @var string */
        public string $tokenString='',

        // @ApiMember(IsRequired=true, ParameterType="path")
        /** @var string */
        public string $service=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['tokenString'])) $this->tokenString = $o['tokenString'];
        if (isset($o['service'])) $this->service = $o['service'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->tokenString)) $o['tokenString'] = $this->tokenString;
        if (isset($this->service)) $o['service'] = $this->service;
        return empty($o) ? new class(){} : $o;
    }
}

PHP AuthorizeTokenFast DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /authorizetokenfast/{Service}/{TokenString} HTTP/1.1 
Host: nkapi-sgepz3-auth.azurewebsites.net 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"tokenString":"String","service":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"isAuthorized":false,"settings":{"String":"String"},"suggestedStatusCode":0,"suggestedResponseMessage":"String","reason":"String"}