GET,POST | /auth/{provider} | ||
---|---|---|---|
GET,POST | /auth |
import 'package:servicestack/servicestack.dart';
// @DataContract
class AuthenticateResponse implements IMeta, IHasSessionId, IHasBearerToken, IConvertible
{
// @DataMember(Order=1)
String? UserId;
// @DataMember(Order=2)
String? SessionId;
// @DataMember(Order=3)
String? UserName;
// @DataMember(Order=4)
String? DisplayName;
// @DataMember(Order=5)
String? ReferrerUrl;
// @DataMember(Order=6)
String? BearerToken;
// @DataMember(Order=7)
String? RefreshToken;
// @DataMember(Order=8)
DateTime? RefreshTokenExpiry;
// @DataMember(Order=9)
String? ProfileUrl;
// @DataMember(Order=10)
List<String>? Roles;
// @DataMember(Order=11)
List<String>? Permissions;
// @DataMember(Order=12)
ResponseStatus? ResponseStatus;
// @DataMember(Order=13)
Map<String,String?>? Meta;
AuthenticateResponse({this.UserId,this.SessionId,this.UserName,this.DisplayName,this.ReferrerUrl,this.BearerToken,this.RefreshToken,this.RefreshTokenExpiry,this.ProfileUrl,this.Roles,this.Permissions,this.ResponseStatus,this.Meta});
AuthenticateResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
UserId = json['UserId'];
SessionId = json['SessionId'];
UserName = json['UserName'];
DisplayName = json['DisplayName'];
ReferrerUrl = json['ReferrerUrl'];
BearerToken = json['BearerToken'];
RefreshToken = json['RefreshToken'];
RefreshTokenExpiry = JsonConverters.fromJson(json['RefreshTokenExpiry'],'DateTime',context!);
ProfileUrl = json['ProfileUrl'];
Roles = JsonConverters.fromJson(json['Roles'],'List<String>',context!);
Permissions = JsonConverters.fromJson(json['Permissions'],'List<String>',context!);
ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
Meta = JsonConverters.toStringMap(json['Meta']);
return this;
}
Map<String, dynamic> toJson() => {
'UserId': UserId,
'SessionId': SessionId,
'UserName': UserName,
'DisplayName': DisplayName,
'ReferrerUrl': ReferrerUrl,
'BearerToken': BearerToken,
'RefreshToken': RefreshToken,
'RefreshTokenExpiry': JsonConverters.toJson(RefreshTokenExpiry,'DateTime',context!),
'ProfileUrl': ProfileUrl,
'Roles': JsonConverters.toJson(Roles,'List<String>',context!),
'Permissions': JsonConverters.toJson(Permissions,'List<String>',context!),
'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!),
'Meta': Meta
};
getTypeName() => "AuthenticateResponse";
TypeContext? context = _ctx;
}
/**
* Sign In
*/
// @Api(Description="Sign In")
// @DataContract
class Authenticate implements IPost, IMeta, IConvertible
{
/**
* AuthProvider, e.g. credentials
*/
// @DataMember(Order=1)
String? provider;
// @DataMember(Order=2)
String? UserName;
// @DataMember(Order=3)
String? Password;
// @DataMember(Order=4)
bool? RememberMe;
// @DataMember(Order=5)
String? AccessToken;
// @DataMember(Order=6)
String? AccessTokenSecret;
// @DataMember(Order=7)
String? ReturnUrl;
// @DataMember(Order=8)
String? ErrorView;
// @DataMember(Order=9)
Map<String,String?>? Meta;
Authenticate({this.provider,this.UserName,this.Password,this.RememberMe,this.AccessToken,this.AccessTokenSecret,this.ReturnUrl,this.ErrorView,this.Meta});
Authenticate.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
provider = json['provider'];
UserName = json['UserName'];
Password = json['Password'];
RememberMe = json['RememberMe'];
AccessToken = json['AccessToken'];
AccessTokenSecret = json['AccessTokenSecret'];
ReturnUrl = json['ReturnUrl'];
ErrorView = json['ErrorView'];
Meta = JsonConverters.toStringMap(json['Meta']);
return this;
}
Map<String, dynamic> toJson() => {
'provider': provider,
'UserName': UserName,
'Password': Password,
'RememberMe': RememberMe,
'AccessToken': AccessToken,
'AccessTokenSecret': AccessTokenSecret,
'ReturnUrl': ReturnUrl,
'ErrorView': ErrorView,
'Meta': Meta
};
getTypeName() => "Authenticate";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'initiation_test.sirva.com', types: <String, TypeInfo> {
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=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: initiation-test.sirva.com
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":"\/Date(-62135596800000-0000)\/","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"}}