OPTIONS,GET,POST,DELETE | /auth | ||
---|---|---|---|
OPTIONS,GET,POST,DELETE | /auth/{provider} |
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 state:String? = null
@DataMember(Order=3)
var oauth_token:String? = null
@DataMember(Order=4)
var oauth_verifier:String? = null
@DataMember(Order=5)
var userName:String? = null
@DataMember(Order=6)
var password:String? = null
@DataMember(Order=7)
var rememberMe:Boolean? = null
@DataMember(Order=9)
var errorView:String? = null
@DataMember(Order=10)
var nonce:String? = null
@DataMember(Order=11)
var uri:String? = null
@DataMember(Order=12)
var response:String? = null
@DataMember(Order=13)
var qop:String? = null
@DataMember(Order=14)
var nc:String? = null
@DataMember(Order=15)
var cnonce:String? = null
@DataMember(Order=17)
var accessToken:String? = null
@DataMember(Order=18)
var accessTokenSecret:String? = null
@DataMember(Order=19)
var scope:String? = null
@DataMember(Order=20)
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 profileUrl:String? = null
@DataMember(Order=9)
var roles:ArrayList<String> = ArrayList<String>()
@DataMember(Order=10)
var permissions:ArrayList<String> = ArrayList<String>()
@DataMember(Order=11)
var responseStatus:ResponseStatus? = null
@DataMember(Order=12)
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 HTTP/1.1
Host: apps.harbourassist.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
provider: String,
state: String,
oauth_token: String,
oauth_verifier: String,
userName: String,
password: String,
rememberMe: False,
errorView: String,
nonce: String,
uri: String,
response: String,
qop: String,
nc: String,
cnonce: String,
accessToken: String,
accessTokenSecret: String,
scope: 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, 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 } }