Ejemplo n.º 1
0
        private void TryWriteBrokerApplicationTokenToKeychain(string clientId, string applicationToken)
        {
            iOSTokenCacheAccessor iOSTokenCacheAccessor = new iOSTokenCacheAccessor();

            try
            {
                SecStatusCode secStatusCode = iOSTokenCacheAccessor.SaveBrokerApplicationToken(clientId, applicationToken);

                _logger.Info(string.Format(
                                 CultureInfo.CurrentCulture,
                                 iOSBrokerConstants.AttemptToSaveBrokerApplicationToken + "SecStatusCode: {0}",
                                 secStatusCode));
            }
            catch (Exception ex)
            {
                throw new MsalClientException(
                          MsalError.WritingApplicationTokenToKeychainFailed,
                          MsalErrorMessage.WritingApplicationTokenToKeychainFailed + ex.Message);
            }
        }
Ejemplo n.º 2
0
        private string TryReadBrokerApplicationTokenFromKeychain(Dictionary <string, string> brokerPayload)
        {
            iOSTokenCacheAccessor iOSTokenCacheAccessor = new iOSTokenCacheAccessor();

            try
            {
                SecStatusCode secStatusCode = iOSTokenCacheAccessor.TryGetBrokerApplicationToken(brokerPayload[BrokerParameter.ClientId], out string appToken);

                _logger.Info(string.Format(
                                 CultureInfo.CurrentCulture,
                                 iOSBrokerConstants.SecStatusCodeFromTryGetBrokerApplicationToken + "SecStatusCode: {0}",
                                 secStatusCode));

                return(appToken);
            }
            catch (Exception ex)
            {
                throw new MsalClientException(
                          MsalError.ReadingApplicationTokenFromKeychainFailed,
                          MsalErrorMessage.ReadingApplicationTokenFromKeychainFailed + ex.Message);
            }
        }