|
I'm new to DevForce 6.1.7.1 with Cocktail 0.6.3 and i'm trying to implement a Multi-tenant Login for our new application, and i'm having some difficulties.
here is how it is suppose to work (high level)
1. User get to an ASPX page and asked for a code (not a password) and a user name with this code i can get to the tenant database 2. I validate that the code is right and then prompt the user for a password (still in aspx) 3. when i have these 3 things i can log in a) user code to get the database name (and build the connection string with it) b) then use that connection string and validate the username/password 4. when the authentication works, i load a silverlight app
Here is the problem I can Successfully validate the user code and get the connection string but for the life of me i cannot validate the username and password, i cannot connect the the customer's user database.
Here is some code
public class AppNameAuthentication : AuthenticationService, IUserService { regular suff }
public virtual IPrincipal Login(ILoginCredential credential, EntityManager entityManager) { if (credential == null) throw new LoginException(LoginExceptionType.NoCredentials, "Credentials are required."); if (string.IsNullOrWhiteSpace(credential.UserName)) throw new LoginException(LoginExceptionType.InvalidUserName, "Username cannot be emptys.");
if (string.IsNullOrWhiteSpace(credential.Password)) throw new LoginException(LoginExceptionType.InvalidPassword, "Password cannot be empty.");
var em = new SecurityEntities(entityManager);
User user = em.Users.FirstOrDefault(u => u.UserId == credential.UserName );
if (user == null) throw new LoginException(LoginExceptionType.InvalidPassword, credential.Domain, credential.UserName);
return new UserPrincipal(user.Id, new UserIdentity(user.UserId, user.ProfileUID.ToString(), true)); }
-- var em = new SecurityEntities(entityManager); this does not user the created connection string but it should.
Thanks for the help
|