GET,POST | /auth/{provider} | ||
---|---|---|---|
GET,POST | /auth |
import java.math.*
import java.util.*
import net.servicestack.client.*
/**
* Sign In
*/
@Api(Description="Sign In")
@DataContract
open class Authenticate : IPost, IMeta
{
/**
* AuthProvider, e.g. credentials
*/
@DataMember(Order=1)
var provider:String? = null
@DataMember(Order=2)
var UserName:String? = null
@DataMember(Order=3)
var Password:String? = null
@DataMember(Order=4)
var RememberMe:Boolean? = null
@DataMember(Order=5)
var AccessToken:String? = null
@DataMember(Order=6)
var AccessTokenSecret:String? = null
@DataMember(Order=7)
var ReturnUrl:String? = null
@DataMember(Order=8)
var ErrorView:String? = null
@DataMember(Order=9)
var Meta:HashMap<String,String> = HashMap<String,String>()
}
@DataContract
open class AuthenticateResponse : IMeta, IHasSessionId, IHasBearerToken
{
@DataMember(Order=1)
var UserId:String? = null
@DataMember(Order=2)
var SessionId:String? = null
@DataMember(Order=3)
var UserName:String? = null
@DataMember(Order=4)
var DisplayName:String? = null
@DataMember(Order=5)
var ReferrerUrl:String? = null
@DataMember(Order=6)
var BearerToken:String? = null
@DataMember(Order=7)
var RefreshToken:String? = null
@DataMember(Order=8)
var RefreshTokenExpiry:Date? = null
@DataMember(Order=9)
var ProfileUrl:String? = null
@DataMember(Order=10)
var Roles:ArrayList<String> = ArrayList<String>()
@DataMember(Order=11)
var Permissions:ArrayList<String> = ArrayList<String>()
@DataMember(Order=12)
var ResponseStatus:ResponseStatus? = null
@DataMember(Order=13)
var Meta:HashMap<String,String> = HashMap<String,String>()
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
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.sirva.com
Accept: text/jsv
Content-Type: text/jsv
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/jsv Content-Length: length { UserId: String, SessionId: String, UserName: String, DisplayName: String, ReferrerUrl: String, BearerToken: String, RefreshToken: String, RefreshTokenExpiry: 0001-01-01, 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 } }