forked from pgina/pgina
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a40431
commit 6fc28d2
Showing
7 changed files
with
317 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# Visual Studio 2010 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SSHAuth", "SSHAuth\SSHAuth.csproj", "{467F6B77-E4FE-47AB-BA14-4520C82EE3EF}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{467F6B77-E4FE-47AB-BA14-4520C82EE3EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{467F6B77-E4FE-47AB-BA14-4520C82EE3EF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{467F6B77-E4FE-47AB-BA14-4520C82EE3EF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{467F6B77-E4FE-47AB-BA14-4520C82EE3EF}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Data; | ||
using System.Drawing; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Windows.Forms; | ||
|
||
namespace pGina.Plugin.SSHAuth | ||
{ | ||
public partial class Configuration : Form | ||
{ | ||
public Configuration() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Diagnostics; | ||
|
||
using log4net; | ||
using pGina.Shared.Interfaces; | ||
using pGina.Shared.Types; | ||
|
||
namespace pGina.Plugin.SSHAuth | ||
{ | ||
public class PluginImpl : IPluginAuthentication, IPluginAuthorization, IPluginAuthenticationGateway ,IPluginChangePassword, IPluginConfiguration | ||
{ | ||
private ILog m_logger = LogManager.GetLogger("SSHAuth"); | ||
|
||
#region Init-plugin | ||
public static Guid PluginUuid | ||
{ | ||
get { return new Guid("{CC35057C-ACA8-499C-B127-AE4CF978F238}"); } | ||
} | ||
|
||
public PluginImpl() | ||
{ | ||
using (Process me = Process.GetCurrentProcess()) | ||
{ | ||
m_logger.DebugFormat("Plugin initialized on {0} in PID: {1} Session: {2}", Environment.MachineName, me.Id, me.SessionId); | ||
} | ||
} | ||
|
||
public string Name | ||
{ | ||
get { return "SSHAuth"; } | ||
} | ||
|
||
public string Description | ||
{ | ||
get { return "SSHAuth plugin"; } | ||
} | ||
|
||
public Guid Uuid | ||
{ | ||
get { return PluginUuid; } | ||
} | ||
|
||
public string Version | ||
{ | ||
get | ||
{ | ||
return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); | ||
} | ||
} | ||
#endregion | ||
|
||
public void Starting() { } | ||
public void Stopping() { } | ||
|
||
public void Configure() | ||
{ | ||
Configuration myDialog = new Configuration(); | ||
myDialog.ShowDialog(); | ||
} | ||
|
||
public BooleanResult AuthenticateUser(SessionProperties properties) | ||
{ | ||
UserInformation userInfo = properties.GetTrackedSingle<UserInformation>(); | ||
|
||
if (userInfo.Username.Contains("hello") && userInfo.Password.Contains("pGina")) | ||
{ | ||
// Successful authentication | ||
return new BooleanResult() { Success = true }; | ||
} | ||
// Authentication failure | ||
return new BooleanResult() { Success = false, Message = "Incorrect username or password." }; | ||
} | ||
|
||
public BooleanResult AuthorizeUser(SessionProperties properties) | ||
{ | ||
return new BooleanResult() { Success = false, Message = "AuthorizeUser test fail" }; | ||
} | ||
|
||
public BooleanResult AuthenticatedUserGateway(SessionProperties properties) | ||
{ | ||
return new BooleanResult() { Success = false, Message = "AuthenticatedUserGateway test fail" }; | ||
} | ||
|
||
public BooleanResult ChangePassword(SessionProperties properties, ChangePasswordPluginActivityInfo pluginInfo) | ||
{ | ||
UserInformation userInfo = properties.GetTrackedSingle<UserInformation>(); | ||
if (userInfo.HasSID) | ||
{ | ||
return new BooleanResult() | ||
{ | ||
Success = false, | ||
Message = String.Format("This is an error message") | ||
}; | ||
} | ||
|
||
return new BooleanResult() { Success = true }; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// Allgemeine Informationen über eine Assembly werden über die folgenden | ||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, | ||
// die mit einer Assembly verknüpft sind. | ||
[assembly: AssemblyTitle("SSHAuth")] | ||
[assembly: AssemblyDescription("ssh authentication")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("University of Illinois at Chicago")] | ||
[assembly: AssemblyProduct("SSHAuth")] | ||
[assembly: AssemblyCopyright("Copyright © University of Illinois at Chicago 2016")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar | ||
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von | ||
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. | ||
[assembly: ComVisible(false)] | ||
|
||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird | ||
[assembly: Guid("dada0db3-2d35-4c73-b8eb-db290e6c895e")] | ||
|
||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: | ||
// | ||
// Hauptversion | ||
// Nebenversion | ||
// Buildnummer | ||
// Revision | ||
// | ||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern | ||
// übernehmen, indem Sie "*" eingeben: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("3.9.9.4")] | ||
[assembly: AssemblyFileVersion("3.9.9.4")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?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>8.0.30703</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{467F6B77-E4FE-47AB-BA14-4520C82EE3EF}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>pGina.Plugin.SSHAuth</RootNamespace> | ||
<AssemblyName>pGina.Plugin.SSHAuth</AssemblyName> | ||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</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>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Abstractions, Version=3.2.4.1, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\..\..\pGina\src\bin\Abstractions.dll</HintPath> | ||
</Reference> | ||
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\..\..\pGina\src\bin\log4net.dll</HintPath> | ||
</Reference> | ||
<Reference Include="pGina.Shared, Version=3.2.4.1, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\..\..\pGina\src\bin\pGina.Shared.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Drawing" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Configuration.cs"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Include="Configuration.Designer.cs"> | ||
<DependentUpon>Configuration.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="PluginImpl.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Settings.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
using pGina.Shared.Settings; | ||
|
||
namespace pGina.Plugin.SSHAuth | ||
{ | ||
public class Settings | ||
{ | ||
private static dynamic m_settings = new pGinaDynamicSettings(PluginImpl.PluginUuid); | ||
|
||
static Settings() | ||
{ | ||
m_settings.SetDefault("Foo", "Bar"); | ||
m_settings.SetDefault("DoSomething", true); | ||
m_settings.SetDefault("ListOfStuff", new string[] { "a", "b", "c" }); | ||
m_settings.SetDefault("Size", 1); | ||
} | ||
|
||
public static dynamic Store | ||
{ | ||
get { return m_settings; } | ||
} | ||
} | ||
} |