INTERNAL-Authorization

<back to all web services

AuthorizeUserFast

Requires Authentication
The following routes are available for this service:
POST/authorizeuserfast/{Service}/{Profile}
<?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 AuthorizeUserFastResponse extends AuthorizeFastBaseResponse implements IAuthorizeUserResponse, 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,
        /** @var string|null */
        public ?string $userObjectId=null,
        /** @var string|null */
        public ?string $userTenant=null,
        /** @var string|null */
        public ?string $userTenantId=null
    ) {
        parent::__construct($isAuthorized,$settings,$suggestedStatusCode,$suggestedResponseMessage,$reason,$customerId);
    }

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

class AuthorizeUserFast implements IAuthorizeUser, JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $bearerToken=null,
        /** @var string|null */
        public ?string $customerContext=null,
        // @ApiMember(ExcludeInSchema=true, IsRequired=true, ParameterType="path")
        /** @var string */
        public string $profile='',

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

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

PHP AuthorizeUserFast DTOs

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

HTTP + JSV

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

POST /authorizeuserfast/{Service}/{Profile} HTTP/1.1 
Host: nkapi-sgepz3-auth-r1.azurewebsites.net 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	bearerToken: String,
	customerContext: String,
	profile: String,
	service: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	userTenant: String,
	userTenantId: String,
	isAuthorized: False,
	settings: 
	{
		String: String
	},
	suggestedStatusCode: 0,
	suggestedResponseMessage: String,
	reason: String
}