internal static Credential From(SQLCredential sqlcred) { Dictionary <string, JToken> attributes = JsonConvert.DeserializeObject <Dictionary <string, JToken> >(sqlcred.Attributes); KinveyUserMetaData userKMD = JsonConvert.DeserializeObject <KinveyUserMetaData>(sqlcred.UserKMD); KinveyAuthSocialID socialIdentity = JsonConvert.DeserializeObject <KinveyAuthSocialID>(sqlcred.AuthSocialID); var credential = new Credential(sqlcred.UserID, sqlcred.AccessToken, socialIdentity, sqlcred.AuthToken, sqlcred.UserName, attributes, userKMD, sqlcred.RefreshToken, sqlcred.RedirectUri, sqlcred.DeviceID, sqlcred.MICClientID); credential.SecAuthToken = sqlcred.SecAuthToken; return(credential); }
virtual public Credential GetStoredCredential(string ssoGroupKey) { Credential cred = null; SQLCredential sqlcred; lock (SQLiteFiles[dbPath]) { sqlcred = _dbConnection.Table <SQLCredential>().FirstOrDefault(); } if (sqlcred != null) { Dictionary <string, JToken> attributes = null; if (sqlcred.Attributes != null) { attributes = JsonConvert.DeserializeObject <Dictionary <string, JToken> >(sqlcred.Attributes); } KinveyUserMetaData kmd = null; if (sqlcred.UserKMD != null) { kmd = JsonConvert.DeserializeObject <KinveyUserMetaData>(sqlcred.UserKMD); } KinveyAuthSocialID socialIdentity = null; if (sqlcred.AuthSocialID != null) { socialIdentity = JsonConvert.DeserializeObject <KinveyAuthSocialID>(sqlcred.AuthSocialID); } cred = new Credential(sqlcred.UserID, sqlcred.AccessToken, socialIdentity, sqlcred.AuthToken, sqlcred.UserName, attributes, kmd, sqlcred.RefreshToken, sqlcred.RedirectUri, sqlcred.DeviceID, sqlcred.MICClientID) { SecAuthToken = sqlcred.SecAuthToken }; } return(cred); }
/// <summary> /// Initializes a new instance of the <see cref="KinveyXamarin.Credential"/> class. /// </summary> /// <param name="userId">User ID</param> /// <param name="accessToken">Access token</param> /// <param name="authToken">Auth token</param> /// <param name="userName">User name</param> /// <param name="attributes">User attributes</param> /// <param name="kmd">Kinvey metadata</param> /// <param name="refreshToken">Refresh token</param> /// <param name="redirectURI">Redirect URI</param> public Credential(string userId, string accessToken, KinveyAuthSocialID socialIdentity, string authToken, string userName, Dictionary <string, JToken> attributes, KinveyUserMetaData kmd, string refreshToken, string redirectURI, string deviceID, string micClientID) { this.userId = userId; this.AccessToken = accessToken; this.AuthSocialID = socialIdentity; this.authToken = authToken; this.userName = userName; this.attributes = attributes; this.userKMD = kmd; this.RefreshToken = refreshToken; this.RedirectUri = redirectURI; this.DeviceID = deviceID; this.MICClientID = micClientID; }