INTERNAL-Authorization

<back to all web services

GetAuthorization

Requires Authentication
The following routes are available for this service:
GET/authorization/{ServiceName}/{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 GetAuthorizationResponse implements JsonSerializable
{
    public function __construct(
        /** @var bool|null */
        public ?bool $isAuthorized=null,
        /** @var array<string,string>|null */
        public ?array $parameters=null,
        /** @var string|null */
        public ?string $userObjectId=null,
        /** @var string|null */
        public ?string $userTenant=null
    ) {
    }

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

class GetAuthorization implements IGetAuthorization, JsonSerializable
{
    public function __construct(
        // @ApiMember(IsRequired=true, ParameterType="path", Verb="GET")
        /** @var string */
        public string $serviceName='',

        // @ApiMember(IsRequired=true, ParameterType="path", Verb="GET")
        /** @var string */
        public string $tokenString='',

        // @ApiMember()
        /** @var string|null */
        public ?string $userTokenString=null,

        // @ApiMember()
        /** @var string|null */
        public ?string $profile=null
    ) {
    }

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

PHP GetAuthorization 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.

GET /authorization/{ServiceName}/{TokenString} HTTP/1.1 
Host: nkapi-sgepz3-auth-r1.azurewebsites.net 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	isAuthorized: False,
	parameters: 
	{
		String: String
	},
	userTenant: String
}