コード例 #1
0
        public void TestStoreLoad()
        {
            //Act
            inMemoryCredentialStore.Store(userId, ssoGroupKey, credential);
            var existingCredential = inMemoryCredentialStore.Load(userId, ssoGroupKey);

            //Assert
            Assert.IsNotNull(existingCredential);
        }
コード例 #2
0
        /// <summary>
        /// Creates a new Credential object from a Kinvey user login/create request, and saves the it in the Credential Store.
        /// </summary>
        /// <returns>The and store credential.</returns>
        /// <param name="response">Response.</param>
        /// <param name="userId">User _id.</param>
        /// <param name="ssoGroupKey">SSO Group Key.</param>
        public Credential CreateAndStoreCredential(KinveyAuthResponse response, string userId, string ssoGroupKey, string deviceID)
        {
            Credential newCredential = Credential.From(response);

            newCredential.DeviceID = deviceID;
            if (userId != null && credentialStore != null)
            {
                var oldCred = credentialStore.Load(userId, ssoGroupKey);
                newCredential.MICClientID = oldCred?.MICClientID;
                credentialStore.Store(userId, ssoGroupKey, newCredential);
            }
            return(newCredential);
        }