private CswAuthorizationToken _authenticate(CswWebSvcSessionAuthenticateData.Authentication.Request AuthenticationRequest) { CswAuthorizationToken Token = null; BasicHttpBinding AuthorizationBinding = new BasicHttpBinding(); EndpointAddress AuthorizationEndpoint = new EndpointAddress(_CswNbtResources.SetupVbls[CswEnumSetupVariableNames.WebSvcAuthorizationPath]); var AuthorizationChannelFactory = new ChannelFactory <ICswAuthorizationWebSvc>(AuthorizationBinding, AuthorizationEndpoint); ICswAuthorizationWebSvc Service = AuthorizationChannelFactory.CreateChannel(); Token = Service.Get(AuthenticationRequest); return(Token); }
private CswNbtObjClassUser _authorizeUser(CswEncryption CswEncryption, CswWebSvcSessionAuthenticateData.Authentication.Request AuthenticationRequest) { CswNbtObjClassUser ret = null; CswNbtObjClassUser UserNode = _CswNbtResources.Nodes.makeUserNodeFromUsername(AuthenticationRequest.UserName, RequireViewPermissions: false); if (UserNode != null && false == UserNode.IsArchived() && false == UserNode.IsAccountLocked()) { CswAuthorizationToken token = _authenticate(AuthenticationRequest); if (null != token) { if (token.Authorized) { UserNode.clearFailedLoginCount(); //We don't keep track of this when using WebSvc Authentication, but if this gets set ot something other than 0 this user won't be able to log in UserNode.LastLogin.DateTimeValue = DateTime.Now; if (null != token.UserId) { UserNode.EmployeeId.Text = token.UserId; } if (null != token.FirstName) { UserNode.FirstNameProperty.Text = token.FirstName; } if (null != token.LastName) { UserNode.LastNameProperty.Text = token.LastName; } if (null != token.Email) { UserNode.EmailProperty.Text = token.Email; } if (null != token.CostCode) { UserNode.CostCode.Text = token.CostCode; } UserNode.postChanges(false); ret = UserNode; } else if (false == string.IsNullOrEmpty(token.ErrorMsg)) { _CswNbtResources.logMessage(token.ErrorMsg); } } } return(ret); }