regis

<back to all web services

Authenticate

auth

Sign In

The following routes are available for this service:
GET,POST/auth/{provider}
GET,POST/auth
<?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};


// @DataContract
class AuthenticateResponse implements IMeta, IHasSessionId, IHasBearerToken, JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var string|null */
        public ?string $userId=null,

        // @DataMember(Order=2)
        /** @var string|null */
        public ?string $sessionId=null,

        // @DataMember(Order=3)
        /** @var string|null */
        public ?string $userName=null,

        // @DataMember(Order=4)
        /** @var string|null */
        public ?string $displayName=null,

        // @DataMember(Order=5)
        /** @var string|null */
        public ?string $referrerUrl=null,

        // @DataMember(Order=6)
        /** @var string|null */
        public ?string $bearerToken=null,

        // @DataMember(Order=7)
        /** @var string|null */
        public ?string $refreshToken=null,

        // @DataMember(Order=8)
        /** @var DateTime|null */
        public ?DateTime $refreshTokenExpiry=null,

        // @DataMember(Order=9)
        /** @var string|null */
        public ?string $profileUrl=null,

        // @DataMember(Order=10)
        /** @var array<string>|null */
        public ?array $roles=null,

        // @DataMember(Order=11)
        /** @var array<string>|null */
        public ?array $permissions=null,

        // @DataMember(Order=12)
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null,

        // @DataMember(Order=13)
        /** @var array<string,string>|null */
        public ?array $meta=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['userId'])) $this->userId = $o['userId'];
        if (isset($o['sessionId'])) $this->sessionId = $o['sessionId'];
        if (isset($o['userName'])) $this->userName = $o['userName'];
        if (isset($o['displayName'])) $this->displayName = $o['displayName'];
        if (isset($o['referrerUrl'])) $this->referrerUrl = $o['referrerUrl'];
        if (isset($o['bearerToken'])) $this->bearerToken = $o['bearerToken'];
        if (isset($o['refreshToken'])) $this->refreshToken = $o['refreshToken'];
        if (isset($o['refreshTokenExpiry'])) $this->refreshTokenExpiry = JsonConverters::from('DateTime', $o['refreshTokenExpiry']);
        if (isset($o['profileUrl'])) $this->profileUrl = $o['profileUrl'];
        if (isset($o['roles'])) $this->roles = JsonConverters::fromArray('string', $o['roles']);
        if (isset($o['permissions'])) $this->permissions = JsonConverters::fromArray('string', $o['permissions']);
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
        if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->userId)) $o['userId'] = $this->userId;
        if (isset($this->sessionId)) $o['sessionId'] = $this->sessionId;
        if (isset($this->userName)) $o['userName'] = $this->userName;
        if (isset($this->displayName)) $o['displayName'] = $this->displayName;
        if (isset($this->referrerUrl)) $o['referrerUrl'] = $this->referrerUrl;
        if (isset($this->bearerToken)) $o['bearerToken'] = $this->bearerToken;
        if (isset($this->refreshToken)) $o['refreshToken'] = $this->refreshToken;
        if (isset($this->refreshTokenExpiry)) $o['refreshTokenExpiry'] = JsonConverters::to('DateTime', $this->refreshTokenExpiry);
        if (isset($this->profileUrl)) $o['profileUrl'] = $this->profileUrl;
        if (isset($this->roles)) $o['roles'] = JsonConverters::toArray('string', $this->roles);
        if (isset($this->permissions)) $o['permissions'] = JsonConverters::toArray('string', $this->permissions);
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Sign In */
// @Api(Description="Sign In")
// @DataContract
class Authenticate implements IPost, IMeta, JsonSerializable
{
    public function __construct(
        /** @description AuthProvider, e.g. credentials */
        // @DataMember(Order=1)
        /** @var string|null */
        public ?string $provider=null,

        // @DataMember(Order=2)
        /** @var string|null */
        public ?string $userName=null,

        // @DataMember(Order=3)
        /** @var string|null */
        public ?string $password=null,

        // @DataMember(Order=4)
        /** @var bool|null */
        public ?bool $rememberMe=null,

        // @DataMember(Order=5)
        /** @var string|null */
        public ?string $accessToken=null,

        // @DataMember(Order=6)
        /** @var string|null */
        public ?string $accessTokenSecret=null,

        // @DataMember(Order=7)
        /** @var string|null */
        public ?string $returnUrl=null,

        // @DataMember(Order=8)
        /** @var string|null */
        public ?string $errorView=null,

        // @DataMember(Order=9)
        /** @var array<string,string>|null */
        public ?array $meta=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['provider'])) $this->provider = $o['provider'];
        if (isset($o['userName'])) $this->userName = $o['userName'];
        if (isset($o['password'])) $this->password = $o['password'];
        if (isset($o['rememberMe'])) $this->rememberMe = $o['rememberMe'];
        if (isset($o['accessToken'])) $this->accessToken = $o['accessToken'];
        if (isset($o['accessTokenSecret'])) $this->accessTokenSecret = $o['accessTokenSecret'];
        if (isset($o['returnUrl'])) $this->returnUrl = $o['returnUrl'];
        if (isset($o['errorView'])) $this->errorView = $o['errorView'];
        if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->provider)) $o['provider'] = $this->provider;
        if (isset($this->userName)) $o['userName'] = $this->userName;
        if (isset($this->password)) $o['password'] = $this->password;
        if (isset($this->rememberMe)) $o['rememberMe'] = $this->rememberMe;
        if (isset($this->accessToken)) $o['accessToken'] = $this->accessToken;
        if (isset($this->accessTokenSecret)) $o['accessTokenSecret'] = $this->accessTokenSecret;
        if (isset($this->returnUrl)) $o['returnUrl'] = $this->returnUrl;
        if (isset($this->errorView)) $o['errorView'] = $this->errorView;
        if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
        return empty($o) ? new class(){} : $o;
    }
}

PHP Authenticate DTOs

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

HTTP + CSV

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

POST /auth/{provider} HTTP/1.1 
Host: data.regent-college.edu 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"provider":"String","userName":"String","password":"String","rememberMe":false,"accessToken":"String","accessTokenSecret":"String","returnUrl":"String","errorView":"String","meta":{"String":"String"}}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"userId":"String","sessionId":"String","userName":"String","displayName":"String","referrerUrl":"String","bearerToken":"String","refreshToken":"String","refreshTokenExpiry":"0001-01-01T00:00:00.0000000","profileUrl":"String","roles":["String"],"permissions":["String"],"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}},"meta":{"String":"String"}}