public AuthenticationResponse Authenticate(AuthenticationRequest request) { if (userAuthenticator.Authenticate(request.Username, request.Password)) { return new AuthenticationResponse { Result = true, Attributes = this.userFinder.GetAttributes(request.Username) }; } return new AuthenticationResponse { Result = false }; }
public AuthenticationResponse Authenticate(AuthenticationRequest request) { ChannelFactory<IAuthenticationService> channelFactory = null; AuthenticationResponse response = null; try { channelFactory = new ChannelFactory<IAuthenticationService>("authentication"); channelFactory.Open(); var service = channelFactory.CreateChannel(); response = service.Authenticate(request); channelFactory.Close(); } catch (CommunicationException) { if (channelFactory != null) { channelFactory.Abort(); } } catch (TimeoutException) { if (channelFactory != null) { channelFactory.Abort(); } } catch (Exception) { if (channelFactory != null) { channelFactory.Abort(); } throw; } return response; }