Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

refactor check on Join method to make it more generic

  • Loading branch information...
commit c15e3a9803fc73068c21eb47a3ca8660a6665540 1 parent ef29883
woloski authored
View
11 JabbR/Hubs/Chat.cs
@@ -74,15 +74,8 @@ public bool Join()
return false;
}
- // Migrate all users to use new auth
- if (!String.IsNullOrEmpty(_settings.AuthApiKey) &&
- String.IsNullOrEmpty(user.Identity))
- {
- return false;
- }
-
- if (!String.IsNullOrEmpty(ConfigurationManager.AppSettings["fedauth.identityProviderUrl"]) &&
- String.IsNullOrEmpty(user.Identity))
+ // Migrate all users to use the non-default auth (janrain or fedauth)
+ if (_settings.AllowNullIdentity(user))
{
return false;
}
View
1  JabbR/JabbR.csproj
@@ -830,6 +830,7 @@
<Compile Include="Migrations\201206201924146_RoomWelcome.Designer.cs">
<DependentUpon>201206201924146_RoomWelcome.cs</DependentUpon>
</Compile>
+ <Compile Include="Services\ApplicationSettingsExtensions.cs" />
<Compile Include="WebApi\Model\ErrorModel.cs" />
<Compile Include="Infrastructure\HttpRequestExtensions.cs" />
<Compile Include="WebApi\MessagesController.cs" />
View
9 JabbR/Services/ApplicationSettings.cs
@@ -36,5 +36,14 @@ public string AuthAppId
return ConfigurationManager.AppSettings["auth.appId"];
}
}
+
+
+ public string FedAuthIdentityProviderUrl
+ {
+ get
+ {
+ return ConfigurationManager.AppSettings["fedauth.identityProviderUrl"];
+ }
+ }
}
}
View
17 JabbR/Services/ApplicationSettingsExtensions.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using JabbR.Models;
+
+namespace JabbR.Services
+{
+ public static class ApplicationSettingsExtensions
+ {
+ public static bool AllowNullIdentity(this IApplicationSettings settings, ChatUser user)
+ {
+ return String.IsNullOrEmpty(user.Identity) &&
+ (!String.IsNullOrEmpty(settings.AuthApiKey) || !String.IsNullOrEmpty(settings.FedAuthIdentityProviderUrl));
+ }
+ }
+}
View
2  JabbR/Services/IApplicationSettings.cs
@@ -9,5 +9,7 @@ public interface IApplicationSettings
string DefaultAdminPassword { get; }
string AuthAppId { get; }
+
+ string FedAuthIdentityProviderUrl { get; }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.