inserito login con rimbalzo via cookie e sito con auth windows

This commit is contained in:
samuele
2012-12-19 17:03:37 +01:00
parent a8add88ada
commit a32e9418a1
46 changed files with 4598 additions and 3 deletions
+2
View File
@@ -35,3 +35,5 @@
/project/PrintLocalReport/obj/Debug/*
/project/PrintLocalReport/obj/Release/*
# Equa_Auth
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<publishData>
<publishProfile publishUrl="https://10.74.82.218:8172/MsDeploy.axd" deleteExistingFiles="False" ftpAnonymousLogin="False" ftpPassiveMode="True" msdeploySite="Default Web Site/Equa_Auth" msdeploySiteID="" msdeployRemoteSitePhysicalPath="" msdeployAllowUntrustedCertificate="True" msdeploySkipExtraFilesOnServer="True" msdeployMarkAsApp="True" profileName="218" publishMethod="MSDeploy" replaceMatchingFiles="True" userName="administrator" savePWD="True" userPWD="AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAANG3mmfjEp0KeNJkVrFBcLQAAAAACAAAAAAADZgAAwAAAABAAAAAwGKPeGP3bFkZjnaMxSDhdAAAAAASAAACgAAAAEAAAAIoknVmNcPXvjZBSotH+mFUQAAAAe64tAdL5SVfRPlNhcbCWbRQAAADU7ia/kO7fMVHJfVHysjmImbZD3w==" SelectedForPublish="True" />
</publishData>
+130
View File
@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Equa_Auth</RootNamespace>
<AssemblyName>Equa_Auth</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<UseIISExpress>false</UseIISExpress>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>
</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ExcludeGeneratedDebugSymbol>true</ExcludeGeneratedDebugSymbol>
<ExcludeApp_Data>true</ExcludeApp_Data>
<DeployIisAppPath>Default Web Site/Equa_Auth</DeployIisAppPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
</ItemGroup>
<ItemGroup>
<Content Include="LandingPage.aspx" />
<Content Include="login.aspx" />
<Content Include="Web.config" />
<Content Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="WebUserControls\mod_login.ascx" />
</ItemGroup>
<ItemGroup>
<Compile Include="LandingPage.aspx.cs">
<DependentUpon>LandingPage.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="LandingPage.aspx.designer.cs">
<DependentUpon>LandingPage.aspx</DependentUpon>
</Compile>
<Compile Include="login.aspx.cs">
<DependentUpon>login.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="login.aspx.designer.cs">
<DependentUpon>login.aspx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WebUserControls\mod_login.ascx.cs">
<DependentUpon>mod_login.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="WebUserControls\mod_login.ascx.designer.cs">
<DependentUpon>mod_login.ascx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\SteamWareLibrary\SteamWare\SteamWare.csproj">
<Project>{2872DCFE-8B46-43B2-BAA0-842A816A2DD5}</Project>
<Name>SteamWare</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="logs\PlaceHolder.file" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>49869</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+27
View File
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<StartPageUrl>login.aspx</StartPageUrl>
<StartAction>CurrentPage</StartAction>
<AspNetDebugging>True</AspNetDebugging>
<SilverlightDebugging>False</SilverlightDebugging>
<NativeDebugging>False</NativeDebugging>
<SQLDebugging>False</SQLDebugging>
<ExternalProgram>
</ExternalProgram>
<StartExternalURL>
</StartExternalURL>
<StartCmdLineArguments>
</StartCmdLineArguments>
<StartWorkingDirectory>
</StartWorkingDirectory>
<EnableENC>False</EnableENC>
<AlwaysStartWebServerOnDebug>True</AlwaysStartWebServerOnDebug>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
+15
View File
@@ -0,0 +1,15 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LandingPage.aspx.cs" Inherits="Equa_Auth.LandingPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Effettuata login utente...
</div>
</form>
</body>
</html>
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Equa_Auth
{
public partial class LandingPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
+26
View File
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Equa_Auth
{
public partial class LandingPage
{
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
}
}
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Equa_Auth")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Equa_Auth")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("076fbb63-2898-40d0-8694-f9c261dab2e7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+30
View File
@@ -0,0 +1,30 @@
<?xml version="1.0"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an atrribute "name" that has a value of "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an atrribute "name" that has a value of "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
+25
View File
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<appSettings>
<!--gestione cookie-->
<add key="enableCookie" value="true" />
<add key="cookieDayExp" value="365" />
<!--logging-->
<add key="_logDir" value="./logs/"/>
<add key="_logLevel" value="5"/>
<add key="_logMaxMb" value="30"/>
<!--area auth DB-->
<add key="PermessiConnectionString" value="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=Equa_XPS_prod;Persist Security Info=True;User id=sa;Password=keyhammer"/>
<add key="UtenteCdcConnectionString" value="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=Equa_Anagrafica;Persist Security Info=True;User id=sa;Password=keyhammer"/>
<add key="VocabolarioConnectionString" value="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=Equa_Vocabolario;Persist Security Info=True;User id=sa;Password=keyhammer"/>
</appSettings>
</configuration>
@@ -0,0 +1,54 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_login.ascx.cs" Inherits="Equa_Auth.WebUserControls.mod_login" %>
<link href="~/Style.css" rel="stylesheet" type="text/css" />
<asp:Panel ID="pnlForceUser" runat="server">
<table width="100%">
<tr>
<td class="chPwdTitle">
<asp:Label runat="server" ID="lblTitolo" />
</td>
</tr>
</table>
<table class="smallTable">
<tr>
<td>
<asp:Label CssClass="chPwdTxt" runat="server" ID="lblPwd" />
</td>
<td>
<asp:TextBox runat="server" ID="authKey" TextMode="Password" Width="210px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label CssClass="chPwdTxt" runat="server" ID="lblDominio" />
</td>
<td>
<asp:TextBox runat="server" ID="dominio" Width="210px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label CssClass="chPwdTxt" runat="server" ID="lblUser" />
</td>
<td>
<asp:TextBox runat="server" ID="user" Width="210px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button Width="100%" runat="server" ID="btnOk" CommandName="ok" CommandArgument="ok" OnClick="btnOk_Click"></asp:Button>
</td>
</tr>
</table>
</asp:Panel>
<table class="smallTable">
<tr>
<td colspan="2">
<asp:Label CssClass="chPwdTxt" ID="lblMessage" runat="server" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:HyperLink ID="HypLinkSSO" runat="server" NavigateUrl="~/login.aspx" Text="Single-Sign-On Login"></asp:HyperLink>
</td>
</tr>
</table>
@@ -0,0 +1,246 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
namespace Equa_Auth.WebUserControls
{
/// <summary>
/// classe gestione login e forzatura login
/// </summary>
public partial class mod_login : ApplicationUserControl
{
#region area protected/private
#region area proprietà
private SteamWare.loginMode _isForceUser = SteamWare.loginMode.normale;
#endregion
#region area metodi
/// <summary>
/// imposta la modalità di login tra normale / forceUser
/// </summary>
private void setLoginMode()
{
if (_isForceUser == SteamWare.loginMode.forceUser)
{
pnlForceUser.Visible = true;
}
else
{
pnlForceUser.Visible = false;
}
}
protected override void traduciObj()
{
lblPwd.Text = user_std.UtSn.Traduci("lblPwd");
lblUser.Text = user_std.UtSn.Traduci("lblUser");
lblDominio.Text = user_std.UtSn.Traduci("lblDominio");
lblTitolo.Text = user_std.UtSn.Traduci("ForzaUtente");
btnOk.Text = user_std.UtSn.Traduci("btnCommit");
}
/// <summary>
/// prova a verificare se l'utente sia ok x AD credentials
/// </summary>
private void AdLogin()
{
lblMessage.Text = "User not authenticated...";
if (Page.User.Identity.IsAuthenticated)
{
//recupera user windows se c'è...
string ad_name = Page.User.Identity.Name;
string delimStr = "\\";
char[] delimiter = delimStr.ToCharArray();
string[] dom_user = ad_name.Split(delimiter, 2);
// salvo cookie!
string DeviceName = "";
string IPv4 = "";
string userAgent = "";
try
{
userAgent = Request.UserAgent;
DeviceName = Request.UserHostName;
IPv4 = Request.UserHostName;
}
catch
{ }
if (memLayer.ML.confReadBool("enableCookie"))
{
// elimino eventuali altri cookie x dominio/user/devName
DataWrap.DW.taAnagDev.delByDominioUserDeviceName(dom_user[0], dom_user[1], DeviceName);
// creo nuovo cookie
authProxy.createNewCookie(dom_user[0], dom_user[1], DeviceName, userAgent, IPv4, Page.Request.QueryString["AuthCookie"].ToString(), DateTime.Now.AddDays(memLayer.ML.confReadInt("cookieDayExp")));
}
// loggo
SteamWare.logger.lg.scriviLog(string.Format("L'utente {0}/{1} ha effettuato il login correttamente", dom_user[0], dom_user[1]), SteamWare.tipoLog.INFO);
if (Login_ok != null)
{
Login_ok(this, new EventArgs());
}
}
else
{
lblMessage.Text = user_std.UtSn.Traduci("AccessFail") + user_std.UtSn.Traduci("UsrNotAuth");
SteamWare.logger.lg.scriviLog(String.Format("Accesso fallito, utente non autenticato"), SteamWare.tipoLog.WARNING);
if (Login_Error != null)
{
Login_Error(this, new EventArgs());
}
}
}
/// <summary>
/// effettua verifiche e se concesso permette di forzare l'accesso utente
/// </summary>
private void ForceUserIdentity()
{
if (Page.User.Identity.IsAuthenticated)
{
bool _allowForceUser = false;
try
{
_allowForceUser = SteamWare.memLayer.ML.confReadBool("_allowForceUser");
}
catch
{
_allowForceUser = false;
}
if (_allowForceUser)
{
if (authKey.Text == "forzaInter") // verifica passphrase...
{
user_std _utente = new user_std();
user_std.UtSn.isForcedUser = true;
bool fatto = _utente.startUpUtente(dominio.Text, user.Text);
if (fatto)
{
string _rigaLog = String.Format("User {0} has forced user identity ok: logged as \t {1}\\{2}", Page.User.Identity.Name, dominio.Text, user.Text);
SteamWare.logger.lg.scriviLog(_rigaLog, SteamWare.tipoLog.INFO);
if (Login_ok != null)
{
Login_ok(this, new EventArgs());
}
}
}
else
{
lblMessage.Text = String.Format("{0}<br>key not allowed for operation!!! operation logged!!!", user_std.UtSn.Traduci("AccessFail"));
mandaEmail(_fromEmail, _adminEmail, "Attenzione: tentativo di accesso non autorizzato!", String.Format("Tentativo di forcing user non autorizzato!<br>L'utente {0} ha tentato di accedere a {1} forzando l'utente ma la sua key autorizzativa e' sbagliata...", Page.User.Identity.Name, user_std.UtSn.Traduci(SteamWare.memLayer.ML.confReadString("defaultApp"))));
string _rigaLog = String.Format("User {0}\t tried to force user - wrong password - he tried to log as \t {1}\\{2}", Page.User.Identity.Name, dominio.Text, user.Text);
SteamWare.logger.lg.scriviLog(_rigaLog, SteamWare.tipoLog.WARNING);
if (Login_Error != null)
{
Login_Error(this, new EventArgs());
}
}
}
else
{
mandaEmail(_fromEmail, _adminEmail, "Attenzione: tentativo di accesso non autorizzato!", String.Format("Tentativo di forcing user non autorizzato!<br>L'utente {0} ha tentato di accedere a {1} forzando l'utente ma la funzione e' disabilitata...", Page.User.Identity.Name, user_std.UtSn.Traduci(SteamWare.memLayer.ML.confReadString("defaultApp"))));
string _rigaLog = String.Format("User {0}\t tried to force user - access disabled - he tried to log as \t {1}\\{2}", Page.User.Identity.Name, dominio.Text, user.Text);
SteamWare.logger.lg.scriviLog(_rigaLog, SteamWare.tipoLog.WARNING);
if (Login_Error != null)
{
Login_Error(this, new EventArgs());
}
}
}
else
{
lblMessage.Text = string.Format("{0}<br>user not authenticated!<br>", user_std.UtSn.Traduci("AccessFail"));
if (Login_Error != null)
{
Login_Error(this, new EventArgs());
}
string _rigaLog = String.Format("\t Someone tried to force user - real user: \t - not autenticated - \t tried to log as \t {0}\\{1}", dominio.Text, user.Text);
SteamWare.logger.lg.scriviLog(_rigaLog, SteamWare.tipoLog.WARNING);
}
}
protected void btnOk_Click(object sender, EventArgs e)
{
ForceUserIdentity();
}
#endregion
#endregion
#region area public
#region eventi pubblici esposti
public event EventHandler Login_ok;
public event EventHandler Login_Error;
#endregion
#region area proprietà
/// <summary>
/// modalità funzionamento controllo tra normale (ActiveDirectory e user auth di default) e forceUser
/// </summary>
public SteamWare.loginMode modoLogin
{
get
{
return _isForceUser;
}
set
{
_isForceUser = value;
}
}
#endregion
/// <summary>
/// avvio pagina
/// </summary>
protected override void Page_Load(object sender, EventArgs e)
{
//carico da web.config i default values
loadDefaultsWebConfig();
// procedo...
setLoginMode();
Session.RemoveAll();
if (_isForceUser == SteamWare.loginMode.normale)
{
bool cookieLogin = false;
if (memLayer.ML.confReadBool("enableCookie"))
{
//string cookieName = memLayer.ML.StringSessionObj("AuthCookie");
//if (cookieName == "")
//{
// cookieName = memLayer.ML.confReadString("AuthCookie");
//}
string cookieName = Page.Request.QueryString["AuthCookie"].ToString();
cookieLogin = authProxy.tryAuthByCookie(cookieName);
}
if (!cookieLogin)
{
AdLogin();
}
else
{
if (Login_ok != null)
{
Login_ok(this, new EventArgs());
}
}
}
}
#endregion
}
}
@@ -0,0 +1,114 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Equa_Auth.WebUserControls {
public partial class mod_login {
/// <summary>
/// pnlForceUser control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel pnlForceUser;
/// <summary>
/// lblTitolo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblTitolo;
/// <summary>
/// lblPwd control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPwd;
/// <summary>
/// authKey control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox authKey;
/// <summary>
/// lblDominio control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblDominio;
/// <summary>
/// dominio control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox dominio;
/// <summary>
/// lblUser control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblUser;
/// <summary>
/// user control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox user;
/// <summary>
/// btnOk control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnOk;
/// <summary>
/// lblMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblMessage;
/// <summary>
/// HypLinkSSO control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink HypLinkSSO;
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
+16
View File
@@ -0,0 +1,16 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="Equa_Auth.login" %>
<%@ Register Src="WebUserControls/mod_login.ascx" TagName="mod_login" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:mod_login ID="mod_login1" runat="server" />
</div>
</form>
</body>
</html>
+56
View File
@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
namespace Equa_Auth
{
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string AuthCookie = "";
try
{
AuthCookie = Page.Request.QueryString["AuthCookie"].ToString();
logger.lg.scriviLog(string.Format("Richiesta verifica cookie: {0}", AuthCookie), tipoLog.INFO);
}
catch
{ }
// salvo nome cookie richiesto
memLayer.ML.setSessionVal("AuthCookie", AuthCookie);
// setto modalità login
mod_login1.modoLogin = SteamWare.loginMode.normale;
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
mod_login1.Login_ok += new EventHandler(Mod_login1_Login_ok);
mod_login1.Login_Error += new EventHandler(Mod_login1_Login_Error);
}
void Mod_login1_Login_Error(object sender, EventArgs e)
{
Response.Redirect("./unauthorized.aspx");
}
void Mod_login1_Login_ok(object sender, EventArgs e)
{
string nextPage = "";
try
{
nextPage = Page.Request.QueryString["jumpPage"].ToString();
}
catch
{
nextPage = "./LandingPage.aspx";
}
logger.lg.scriviLog(string.Format("Login ok, redirecting to {0}", nextPage), tipoLog.INFO);
Response.Redirect(nextPage);
}
}
}
+33
View File
@@ -0,0 +1,33 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Equa_Auth {
public partial class login {
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// mod_login1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Equa_Auth.WebUserControls.mod_login mod_login1;
}
}
+1
View File
@@ -0,0 +1 @@

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+5 -2
View File
@@ -109,11 +109,14 @@
</system.web>
<appSettings>
<add key="CodModulo" value="XPS"/>
<add key="dominio" value="steamwarewin"/>
<add key="_navMaxChar" value="20"/>
<!--gestione cookie-->
<add key="AuthCookie" value="XPST"/>
<add key="enableCookie" value="true" />
<add key="cookieDayExp" value="365" />
<add key ="authSite" value="http://10.74.82.218/Equa_Auth/"/>
<add key ="currSite" value="http://10.74.82.218/XPST/"/>
<!--gestione pagina-->
<add key="intUpdatePagina_ms" value="120000"/>
<add key="_righeDataGrid" value="30"/>
<add key="_righeDataGridAnagr" value="20"/>
@@ -121,6 +124,7 @@
<add key="_righeDataGridMed" value="15"/>
<add key="_righeDataGridShort" value="10"/>
<add key="_fromEmail" value="xps@steamware.net"/>
<add key="_logDir" value="./logs/"/>
<add key="_logLevel" value="5"/>
<add key="_logMaxMb" value="30"/>
<add key="_allowForceUser" value="true"/>
@@ -139,7 +143,6 @@
<add key="_jumpStart" value="10"/>
<add key="defDayLeadTime" value="3"/>
<add key="_adminEmail" value="equa@steamware.net"/>
<add key="_logDir" value="./logs/"/>
<add key="_smtpCli" value="keyhammer.ath.cx"/>
<add key="XPSConnectionString" value="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=Equa_XPS_prod;Persist Security Info=True;User id=sa;Password=keyhammer"/>
<add key="PermessiConnectionString" value="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=Equa_XPS_prod;Persist Security Info=True;User id=sa;Password=keyhammer"/>
@@ -250,7 +250,7 @@ namespace XPST.WebUserControls
bool cookieLogin = false;
if (memLayer.ML.confReadBool("enableCookie"))
{
cookieLogin = authProxy.tryAuthByCookie(memLayer.ML.confReadString("CodModulo"));
cookieLogin = authProxy.tryAuthByCookie(memLayer.ML.confReadString("AuthCookie"));
}
if (!cookieLogin)
{
Binary file not shown.
Binary file not shown.
Binary file not shown.
+20
View File
@@ -4,6 +4,7 @@ using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
namespace XPST
{
@@ -26,6 +27,25 @@ namespace XPST
{
// pulisco i record di viewstate vecchi...
RemoveViewStateFiles();
// controllo cookie...
bool cookieLogin = false;
if (memLayer.ML.confReadBool("enableCookie"))
{
cookieLogin = authProxy.tryAuthByCookie(memLayer.ML.confReadString("AuthCookie"));
}
if (!cookieLogin)
{
// compongo stringa x sito auth
string authPage = "./unauthorized.aspx";
try
{
authPage = string.Format("{0}login.aspx?AuthCookie={1}&jumpPage={2}", memLayer.ML.confReadString("authSite"), memLayer.ML.confReadString("AuthCookie"), memLayer.ML.confReadString("currSite"));
}
catch
{ }
Response.Redirect(authPage);
}
// setto modalità login
mod_login1.modoLogin = SteamWare.loginMode.normale;
}
Binary file not shown.
Binary file not shown.
View File
Binary file not shown.
+20
View File
@@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XPST", "XPST\XPST.csproj",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamWare", "..\..\SteamWareLibrary\SteamWare\SteamWare.csproj", "{2872DCFE-8B46-43B2-BAA0-842A816A2DD5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Equa_Auth", "Equa_Auth\Equa_Auth.csproj", "{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET = Debug|.NET
@@ -94,6 +96,24 @@ Global
{2872DCFE-8B46-43B2-BAA0-842A816A2DD5}.Release|Any CPU.Build.0 = Release|Any CPU
{2872DCFE-8B46-43B2-BAA0-842A816A2DD5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{2872DCFE-8B46-43B2-BAA0-842A816A2DD5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.Debug|.NET.ActiveCfg = Debug|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.Debug|.NET.Build.0 = Debug|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.EQUA|.NET.ActiveCfg = Release|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.EQUA|.NET.Build.0 = Release|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.EQUA|Any CPU.ActiveCfg = Release|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.EQUA|Any CPU.Build.0 = Release|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.EQUA|Mixed Platforms.ActiveCfg = Release|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.EQUA|Mixed Platforms.Build.0 = Release|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.Release|.NET.ActiveCfg = Release|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.Release|.NET.Build.0 = Release|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.Release|Any CPU.Build.0 = Release|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{BDD58632-ED9F-46DE-ABE9-8B7E228EFA72}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.