summaryrefslogtreecommitdiffstats
path: root/samples/DotNetOpenAuth.ApplicationBlock
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-04-19 08:24:54 -0400
committerAndrew Arnott <andrewarnott@gmail.com>2010-04-19 08:24:54 -0400
commitb3eeaa8855f0eca9428155c5d953fcb0502190c5 (patch)
tree060c34d8db246020d78120d2e669c1e7448d8261 /samples/DotNetOpenAuth.ApplicationBlock
parent668c50fd19dc633bd367ac8ace37df8b5f9a5881 (diff)
downloadDotNetOpenAuth-b3eeaa8855f0eca9428155c5d953fcb0502190c5.zip
DotNetOpenAuth-b3eeaa8855f0eca9428155c5d953fcb0502190c5.tar.gz
DotNetOpenAuth-b3eeaa8855f0eca9428155c5d953fcb0502190c5.tar.bz2
Adjusted how the sample InMemoryTokenManager class is defined so that it is more difficult to use in real apps without knowing its limited scope.
Diffstat (limited to 'samples/DotNetOpenAuth.ApplicationBlock')
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj6
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/InMemoryTokenManager.cs6
2 files changed, 9 insertions, 3 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj b/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj
index 41aff68..f1da85a 100644
--- a/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj
+++ b/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj
@@ -38,7 +38,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DefineConstants>TRACE;DEBUG;SAMPLESONLY</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
@@ -84,7 +84,9 @@
<Compile Include="CustomExtensions\AcmeRequest.cs" />
<Compile Include="CustomExtensions\AcmeResponse.cs" />
<Compile Include="GoogleConsumer.cs" />
- <Compile Include="InMemoryTokenManager.cs" />
+ <Compile Include="InMemoryTokenManager.cs">
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TwitterConsumer.cs" />
<Compile Include="Util.cs" />
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/InMemoryTokenManager.cs b/samples/DotNetOpenAuth.ApplicationBlock/InMemoryTokenManager.cs
index 8b769de..b9cc2b8 100644
--- a/samples/DotNetOpenAuth.ApplicationBlock/InMemoryTokenManager.cs
+++ b/samples/DotNetOpenAuth.ApplicationBlock/InMemoryTokenManager.cs
@@ -12,6 +12,7 @@ namespace DotNetOpenAuth.ApplicationBlock {
using DotNetOpenAuth.OAuth.Messages;
using DotNetOpenAuth.OpenId.Extensions.OAuth;
+#if SAMPLESONLY
/// <summary>
/// A token manager that only retains tokens in memory.
/// Meant for SHORT TERM USE TOKENS ONLY.
@@ -21,7 +22,7 @@ namespace DotNetOpenAuth.ApplicationBlock {
/// where the user only signs in without providing any authorization to access
/// Twitter APIs except to authenticate, since that access token is only useful once.
/// </remarks>
- public class InMemoryTokenManager : IConsumerTokenManager, IOpenIdOAuthTokenManager {
+ internal class InMemoryTokenManager : IConsumerTokenManager, IOpenIdOAuthTokenManager {
private Dictionary<string, string> tokensAndSecrets = new Dictionary<string, string>();
/// <summary>
@@ -140,4 +141,7 @@ namespace DotNetOpenAuth.ApplicationBlock {
#endregion
}
+#else
+#error The InMemoryTokenManager class is only for samples as it forgets all tokens whenever the application restarts! You should implement IConsumerTokenManager in your own app that stores tokens in a persistent store (like a SQL database).
+#endif
} \ No newline at end of file