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 .xml suffix or ?format=xml

HTTP + XML

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-r1.azurewebsites.net 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<AuthorizeTokenFast xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Norkart.Api.Authorization.ServiceModel">
  <Service>String</Service>
  <TokenString>String</TokenString>
</AuthorizeTokenFast>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<AuthorizeTokenFastResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Norkart.Api.Authorization.ServiceModel">
  <CustomerId i:nil="true" />
  <IsAuthorized>false</IsAuthorized>
  <Reason>String</Reason>
  <Settings xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringstring>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:KeyValueOfstringstring>
  </Settings>
  <SuggestedResponseMessage>String</SuggestedResponseMessage>
  <SuggestedStatusCode>0</SuggestedStatusCode>
</AuthorizeTokenFastResponse>