summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth.Consumer/OAuth/MemoryTemporaryCredentialStorage.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2013-03-26 11:19:06 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2013-03-26 11:19:06 -0700
commit3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb (patch)
treec15816c3d7f6e74334553f2ff98605ce1c22c538 /src/DotNetOpenAuth.OAuth.Consumer/OAuth/MemoryTemporaryCredentialStorage.cs
parent5e9014f36b2d53b8e419918675df636540ea24e2 (diff)
parente6f7409f4caceb7bc2a5b4ddbcb1a4097af340f2 (diff)
downloadDotNetOpenAuth-3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb.zip
DotNetOpenAuth-3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb.tar.gz
DotNetOpenAuth-3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb.tar.bz2
Move to HttpClient throughout library.
Diffstat (limited to 'src/DotNetOpenAuth.OAuth.Consumer/OAuth/MemoryTemporaryCredentialStorage.cs')
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/MemoryTemporaryCredentialStorage.cs65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/MemoryTemporaryCredentialStorage.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/MemoryTemporaryCredentialStorage.cs
new file mode 100644
index 0000000..832084d
--- /dev/null
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/MemoryTemporaryCredentialStorage.cs
@@ -0,0 +1,65 @@
+//-----------------------------------------------------------------------
+// <copyright file="MemoryTemporaryCredentialStorage.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.OAuth {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.Threading.Tasks;
+
+ /// <summary>
+ /// Non-persistent memory storage for temporary credentials.
+ /// Useful for installed apps (not redirection based web apps).
+ /// </summary>
+ public class MemoryTemporaryCredentialStorage : ITemporaryCredentialStorage {
+ /// <summary>
+ /// The identifier.
+ /// </summary>
+ private string identifier;
+
+ /// <summary>
+ /// The secret.
+ /// </summary>
+ private string secret;
+
+ #region ITemporaryCredentialStorage Members
+
+ /// <summary>
+ /// Saves the specified temporary credential for later retrieval.
+ /// </summary>
+ /// <param name="identifier">The identifier.</param>
+ /// <param name="secret">The secret.</param>
+ public void SaveTemporaryCredential(string identifier, string secret) {
+ this.identifier = identifier;
+ this.secret = secret;
+ }
+
+ /// <summary>
+ /// Obtains a temporary credential secret, if available.
+ /// </summary>
+ /// <returns>
+ /// The temporary credential secret if available; otherwise <c>null</c>.
+ /// </returns>
+ public KeyValuePair<string, string> RetrieveTemporaryCredential() {
+ return new KeyValuePair<string, string>(this.identifier, this.secret);
+ }
+
+ /// <summary>
+ /// Clears the temporary credentials from storage.
+ /// </summary>
+ /// <param name="identifier">The identifier of the credentials to clear.</param>
+ /// <remarks>
+ /// DotNetOpenAuth calls this when the credentials are no longer needed.
+ /// </remarks>
+ public void ClearTemporaryCredential() {
+ this.identifier = null;
+ this.secret = null;
+ }
+
+ #endregion
+ }
+}