diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-03-26 14:17:05 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-03-26 14:17:05 -0700 |
commit | 1bfeae7973d31f3e69a83793d95904abf4f653bc (patch) | |
tree | 50938143aae7a17001c68c99ffc3bcdb5bac6f1f /samples/Consumer/App_Code/InMemoryTokenManager.cs | |
parent | 00f1f6baf79d6f42bcaaf24b1e43f3c86f540b2a (diff) | |
download | DotNetOpenAuth-1bfeae7973d31f3e69a83793d95904abf4f653bc.zip DotNetOpenAuth-1bfeae7973d31f3e69a83793d95904abf4f653bc.tar.gz DotNetOpenAuth-1bfeae7973d31f3e69a83793d95904abf4f653bc.tar.bz2 |
Renamed OAuth sample sites.
Diffstat (limited to 'samples/Consumer/App_Code/InMemoryTokenManager.cs')
-rw-r--r-- | samples/Consumer/App_Code/InMemoryTokenManager.cs | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/samples/Consumer/App_Code/InMemoryTokenManager.cs b/samples/Consumer/App_Code/InMemoryTokenManager.cs deleted file mode 100644 index f36a396..0000000 --- a/samples/Consumer/App_Code/InMemoryTokenManager.cs +++ /dev/null @@ -1,72 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="InMemoryTokenManager.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using DotNetOpenAuth.OAuth.ChannelElements; -using DotNetOpenAuth.OAuth.Messages; - -public class InMemoryTokenManager : ITokenManager { - private Dictionary<string, string> tokensAndSecrets = new Dictionary<string, string>(); - - public InMemoryTokenManager(string consumerKey, string consumerSecret) { - this.ConsumerKey = consumerKey; - this.ConsumerSecret = consumerSecret; - } - - public string ConsumerKey { get; private set; } - - public string ConsumerSecret { get; private 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 -} |