summaryrefslogtreecommitdiffstats
path: root/samples/ConsumerWpf/InMemoryTokenManager.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-03-26 14:09:42 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-03-26 14:09:42 -0700
commit79dee332a2be944d9ff55db0b3d53fdeaab96efd (patch)
tree9987e89e1941161cd7673ca8e1f8d5d41af97930 /samples/ConsumerWpf/InMemoryTokenManager.cs
parent4238297df55276ca36facb42e95ad84eb4937962 (diff)
downloadDotNetOpenAuth-79dee332a2be944d9ff55db0b3d53fdeaab96efd.zip
DotNetOpenAuth-79dee332a2be944d9ff55db0b3d53fdeaab96efd.tar.gz
DotNetOpenAuth-79dee332a2be944d9ff55db0b3d53fdeaab96efd.tar.bz2
Renamed ConsumerWpf sample to OAuthConsumerWpf.
Diffstat (limited to 'samples/ConsumerWpf/InMemoryTokenManager.cs')
-rw-r--r--samples/ConsumerWpf/InMemoryTokenManager.cs72
1 files changed, 0 insertions, 72 deletions
diff --git a/samples/ConsumerWpf/InMemoryTokenManager.cs b/samples/ConsumerWpf/InMemoryTokenManager.cs
deleted file mode 100644
index 2b89f39..0000000
--- a/samples/ConsumerWpf/InMemoryTokenManager.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="InMemoryTokenManager.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.Samples.ConsumerWpf {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using DotNetOpenAuth.OAuth.ChannelElements;
- using DotNetOpenAuth.OAuth.Messages;
-
- internal class InMemoryTokenManager : ITokenManager {
- private Dictionary<string, string> tokensAndSecrets = new Dictionary<string, string>();
-
- internal InMemoryTokenManager() {
- }
-
- internal string ConsumerKey { get; set; }
-
- internal string ConsumerSecret { get; set; }
-
- #region ITokenManager Members
-
- public string GetConsumerSecret(string consumerKey) {
- if (consumerKey == this.ConsumerKey) {
- return this.ConsumerSecret;
- } else {
- throw new ArgumentException("Unrecognized consumer key.", "consumerKey");
- }
- }
-
- public string GetTokenSecret(string token) {
- return this.tokensAndSecrets[token];
- }
-
- public void StoreNewRequestToken(UnauthorizedTokenRequest request, ITokenSecretContainingMessage response) {
- this.tokensAndSecrets[response.Token] = response.TokenSecret;
- }
-
- /// <summary>
- /// Checks whether a given request token has already been authorized
- /// by some user for use by the Consumer that requested it.
- /// </summary>
- /// <param name="requestToken">The Consumer's request token.</param>
- /// <returns>
- /// True if the request token has already been fully authorized by the user
- /// who owns the relevant protected resources. False if the token has not yet
- /// been authorized, has expired or does not exist.
- /// </returns>
- public bool IsRequestTokenAuthorized(string requestToken) {
- throw new NotImplementedException();
- }
-
- public void ExpireRequestTokenAndStoreNewAccessToken(string consumerKey, string requestToken, string accessToken, string accessTokenSecret) {
- this.tokensAndSecrets.Remove(requestToken);
- this.tokensAndSecrets[accessToken] = accessTokenSecret;
- }
-
- /// <summary>
- /// Classifies a token as a request token or an access token.
- /// </summary>
- /// <param name="token">The token to classify.</param>
- /// <returns>Request or Access token, or invalid if the token is not recognized.</returns>
- public TokenType GetTokenType(string token) {
- throw new NotImplementedException();
- }
-
- #endregion
- }
-}