//-----------------------------------------------------------------------
//
// Copyright (c) Andrew Arnott. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OAuth {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
///
/// Non-persistent memory storage for temporary credentials.
/// Useful for installed apps (not redirection based web apps).
///
public class MemoryTemporaryCredentialStorage : ITemporaryCredentialStorage {
///
/// The identifier.
///
private string identifier;
///
/// The secret.
///
private string secret;
#region ITemporaryCredentialStorage Members
///
/// Saves the specified temporary credential for later retrieval.
///
/// The identifier.
/// The secret.
public void SaveTemporaryCredential(string identifier, string secret) {
this.identifier = identifier;
this.secret = secret;
}
///
/// Obtains a temporary credential secret, if available.
///
///
/// The temporary credential secret if available; otherwise null.
///
public KeyValuePair RetrieveTemporaryCredential() {
return new KeyValuePair(this.identifier, this.secret);
}
///
/// Clears the temporary credentials from storage.
///
///
/// DotNetOpenAuth calls this when the credentials are no longer needed.
///
public void ClearTemporaryCredential() {
this.identifier = null;
this.secret = null;
}
#endregion
}
}