Ejemplo n.º 1
0
        protected void BaseConstructor(String enterpriseServerName, String enterpriseDatabaseName, String sqlUserName, String sqlPassword, String environmentName)
        {
            enterpriseConfiguration.ServerName = enterpriseServerName;

            enterpriseConfiguration.DatabaseName = enterpriseDatabaseName;

            enterpriseConfiguration.TrustedConnection = String.IsNullOrEmpty(sqlUserName);

            enterpriseConfiguration.UserName = sqlUserName;

            enterpriseConfiguration.Password = sqlPassword;


            EnvironmentName = environmentName;


            Mercury.Server.Security.Security security = new Mercury.Server.Security.Security();

            Mercury.Server.Security.AuthenticationResponse authenticationResponse = security.Authenticate(enterpriseConfiguration, environmentName);

            if (!authenticationResponse.IsAuthenticated)
            {
                Exception authenticationException = new ApplicationException("Unable to authenticate [" + enterpriseServerName + "." + enterpriseDatabaseName + " : " + environmentName + " / " + sqlUserName + "]. " + authenticationResponse.AuthenticationError.ToString(),

                                                                             (authenticationResponse.AuthenticationException != null) ? new ApplicationException(authenticationResponse.AuthenticationException.Message) : null);

                throw authenticationException;
            }

            token = authenticationResponse.Token;

            application = new Application(enterpriseConfiguration, token);

            return;
        }
Ejemplo n.º 2
0
        public AuthenticationResponse AuthenticateWindows(String environment)
        {
            AuthenticationResponse response = new AuthenticationResponse();

            try {
                Mercury.Server.Security.Security security = new Mercury.Server.Security.Security();

                response = new AuthenticationResponse(security.Authenticate(environment));
            }

            catch (Exception authenticationException) {
                Server.Application application = new Application();

                application.SetLastException(authenticationException);

                response.SetException(authenticationException);
            }

            return(response);
        }
Ejemplo n.º 3
0
        public AuthenticationResponse Authenticate(String authorityName, String accountType, String accountName, String password, String newPassword, String environment)
        {
            Mercury.Server.Security.Security security = new Mercury.Server.Security.Security();

            return(new AuthenticationResponse(security.Authenticate(authorityName, accountType, accountName, password, newPassword, environment)));
        }