Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4020


Ignore:
Timestamp:
07/08/10 21:48:27 (14 years ago)
Author:
bfarka
Message:

implemented first working authorization test!
(#1046)

Location:
branches/HeuristicLab.Services.Authentication Prototype
Files:
10 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Services.Authentication Prototype/Service/App.config

    r4002 r4020  
    1414  </system.web>
    1515  <system.serviceModel>
     16    <bindings>
     17    <wsHttpBinding>
     18      <binding name="Binding">
     19        <security mode="Message">
     20          <message
     21                clientCredentialType="UserName"/>
     22        </security>
     23      </binding>
     24   </wsHttpBinding>
     25    </bindings>
    1626    <behaviors>
    1727      <serviceBehaviors>
    18         <serviceCredentials>
    19           <userNameAuthentication      membershipProviderName="HeuristiclabMemberShipProvider" />
    20         </serviceCredentials>
    2128        <behavior name="HttpServiceBehavior">
     29          <serviceCredentials>
     30           
     31            <userNameAuthentication membershipProviderName="HeuristiclabMemberShipProvider" userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Service.Provider.HeuristicLabUsernamePasswordValidator, Service" />
     32            <!-- the name and store of the certificate has to be customized for each server to run-->
     33            <serviceCertificate findValue="MyServerCert" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My" />
     34          </serviceCredentials>
    2235          <serviceMetadata httpGetEnabled="true" httpGetUrl="http://127.0.0.1:8888/metadata" />
    2336          <serviceDebug httpHelpPageUrl="http://127.0.0.1:8888/debug" />
     
    2841      <service behaviorConfiguration="HttpServiceBehavior" name="Service.Services.Administration.AuthorizationManagementService">
    2942        <endpoint address="http://127.0.0.1:8888/AuthorizationManagementEndpoint"
    30           binding="basicHttpBinding" bindingConfiguration="" contract="Service.Services.Administration.IAuthorizationManagementService" />
     43          binding="wsHttpBinding" bindingConfiguration="Binding" contract="Service.Services.Administration.IAuthorizationManagementService" />
    3144        <host>
    3245          <baseAddresses>
  • branches/HeuristicLab.Services.Authentication Prototype/Service/Service.csproj

    r3970 r4020  
    4141      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    4242    </Reference>
     43    <Reference Include="System.IdentityModel">
     44      <RequiredTargetFramework>3.0</RequiredTargetFramework>
     45    </Reference>
     46    <Reference Include="System.IdentityModel.Selectors">
     47      <RequiredTargetFramework>3.0</RequiredTargetFramework>
     48    </Reference>
    4349    <Reference Include="System.Runtime.Serialization">
    4450      <RequiredTargetFramework>3.0</RequiredTargetFramework>
    4551    </Reference>
     52    <Reference Include="System.Security" />
    4653    <Reference Include="System.ServiceModel">
    4754      <RequiredTargetFramework>3.0</RequiredTargetFramework>
     
    5764    <Compile Include="Provider\HeuristicLabMembershipProvider.cs" />
    5865    <Compile Include="Provider\HeuristicLabRoleProvider.cs" />
     66    <Compile Include="Provider\HeuristicLabUsernamePasswordValidator.cs" />
    5967    <Compile Include="Services\Administration\AuthorizationManagementService.cs" />
    6068    <Compile Include="Services\Administration\IAuthorizationManagementService.cs" />
  • branches/HeuristicLab.Services.Authentication Prototype/UnitTests/UnitTests.csproj

    r4002 r4020  
    4545      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    4646    </Reference>
     47    <Reference Include="System.IdentityModel">
     48      <RequiredTargetFramework>3.0</RequiredTargetFramework>
     49    </Reference>
     50    <Reference Include="System.IdentityModel.Selectors">
     51      <RequiredTargetFramework>3.0</RequiredTargetFramework>
     52    </Reference>
    4753    <Reference Include="System.Runtime.Serialization">
    4854      <RequiredTargetFramework>3.0</RequiredTargetFramework>
     
    6268    <Compile Include="HeuristicLabRoleProviderTest.cs" />
    6369    <Compile Include="Properties\AssemblyInfo.cs" />
    64     <Compile Include="Service References\ServiceManagementRemote\Reference.cs">
     70    <Compile Include="Service References\AuthorizationManagementServiceRemote\Reference.cs">
    6571      <AutoGen>True</AutoGen>
    6672      <DesignTime>True</DesignTime>
     
    7076    <Compile Include="service\HeuristicLabAuthorizationManagementServiceTest_old.cs" />
    7177    <Compile Include="service\HeuristicLabManagementServiceTest.cs" />
     78    <Compile Include="service\MyX509Validator.cs" />
    7279  </ItemGroup>
    7380  <ItemGroup>
    7481    <Content Include="AuthoringTests.txt" />
    75     <None Include="Service References\ServiceManagementRemote\Reference.svcmap">
     82    <None Include="Service References\AuthorizationManagementServiceRemote\Reference.svcmap">
    7683      <Generator>WCF Proxy Generator</Generator>
    7784      <LastGenOutput>Reference.cs</LastGenOutput>
    7885    </None>
    79     <None Include="Service References\ServiceManagementRemote\configuration.svcinfo" />
    80     <None Include="Service References\ServiceManagementRemote\configuration91.svcinfo" />
     86    <None Include="Service References\AuthorizationManagementServiceRemote\configuration.svcinfo" />
     87    <None Include="Service References\AuthorizationManagementServiceRemote\configuration91.svcinfo" />
    8188  </ItemGroup>
    8289  <ItemGroup>
     
    98105  <ItemGroup>
    99106    <None Include="app.config" />
    100     <None Include="Service References\ServiceManagementRemote\AuthorizationManagementService.wsdl" />
    101     <None Include="Service References\ServiceManagementRemote\metadata.xsd" />
    102     <None Include="Service References\ServiceManagementRemote\metadata1.xsd" />
     107    <None Include="Service References\AuthorizationManagementServiceRemote\AuthorizationManagementService.wsdl" />
     108    <None Include="Service References\AuthorizationManagementServiceRemote\metadata.xsd" />
     109    <None Include="Service References\AuthorizationManagementServiceRemote\metadata1.xsd" />
    103110  </ItemGroup>
    104111  <ItemGroup>
    105     <WCFMetadataStorage Include="Service References\ServiceManagementRemote\" />
     112    <WCFMetadataStorage Include="Service References\AuthorizationManagementServiceRemote\" />
    106113  </ItemGroup>
    107114  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  • branches/HeuristicLab.Services.Authentication Prototype/UnitTests/app.config

    r4002 r4020  
    11<?xml version="1.0" encoding="utf-8" ?>
    22<configuration>
    3     <system.serviceModel>
    4         <bindings>
    5             <basicHttpBinding>
    6                 <binding name="BasicHttpBinding_IAuthorizationManagementService"
    7                     closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00"
    8                     sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false"
    9                     hostNameComparisonMode="StrongWildcard" maxBufferSize="65536"
    10                     maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
    11                     messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
    12                     useDefaultWebProxy="true">
    13                     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
    14                         maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    15                     <security mode="None">
    16                         <transport clientCredentialType="None" proxyCredentialType="None"
    17                             realm="">
    18                             <extendedProtectionPolicy policyEnforcement="Never" />
    19                         </transport>
    20                         <message clientCredentialType="UserName" algorithmSuite="Default" />
    21                     </security>
    22                 </binding>
    23             </basicHttpBinding>
    24         </bindings>
    25         <client>
    26             <endpoint address="http://127.0.0.1:8888/AuthorizationManagementEndpoint"
    27                 binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAuthorizationManagementService"
    28                 contract="ServiceManagementRemote.IAuthorizationManagementService"
    29                 name="BasicHttpBinding_IAuthorizationManagementService" />
    30         </client>
    31 
    32 
    33 
    34 
     3  <system.web>
     4    <compilation debug="true" />
     5    <membership defaultProvider="HeuristiclabMemberShipProvider" userIsOnlineTimeWindow="15">
     6      <providers>
     7        <clear/>
     8        <add
     9          name="HeuristiclabMemberShipProvider"
     10          type="Service.Provider.HeuristicLabMembershipProvider, Service"
     11          passwordFormat="Hashed" />
     12      </providers>
     13    </membership>
     14  </system.web>
     15  <system.serviceModel>
     16    <client>
     17      <endpoint address="http://127.0.0.1:8888/AuthorizationManagementEndpoint"
     18        binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IAuthorizationManagementService"
     19        contract="AuthorizationManagementServiceRemote.IAuthorizationManagementService"
     20        name="WSHttpBinding_IAuthorizationManagementService" behaviorConfiguration="myClientBehavior">
     21        <identity>
     22          <certificate encodedValue="AwAAAAEAAAAUAAAAPQJndve7Q/IcQ7WtwQMm02KvlrsgAAAAAQAAALgBAAAwggG0MIIBYqADAgECAhDDg1lnKGezhkH5Ju3ecmECMAkGBSsOAwIdBQAwFjEUMBIGA1UEAxMLUm9vdCBBZ2VuY3kwHhcNMTAwNTI2MjE1NDExWhcNMzkxMjMxMjM1OTU5WjAXMRUwEwYDVQQDEwxNeVNlcnZlckNlcnQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANsuzLfWt1O+qHpnxGDkBZCthxB4MMIfx0QSFAbUaw2YTPQu4AaoxKoMo/TeHuFmJKtrRY0Z9UTVts+KCrn+3vozmSv67YgAGh+ney2X8WgoEowmYsfJlcCtJ8OX34OXASMLlu84Q7jFs5Y/VIxNA5pvlw7bCiHus6yDu7o+b86XAgMBAAGjSzBJMEcGA1UdAQRAMD6AEBLkCS0GHR1PAI1hIdwWZGOhGDAWMRQwEgYDVQQDEwtSb290IEFnZW5jeYIQBjdsAKoAZIoRz7jUqlw19DAJBgUrDgMCHQUAA0EADYxnIrj8jVWXvohKWb4N7dc2WQ//3hFdovHbsCiE4Pz7ozi8mR/GixdbLKhm/rCr1M5eoiaz8xNkoa5owMB/xQ==" />
     23        </identity>
     24      </endpoint>
     25    </client>
     26    <bindings>
     27      <wsHttpBinding>
     28        <binding name="Binding">
     29          <security mode="Message">
     30            <transport>
     31              <extendedProtectionPolicy policyEnforcement="Never" />
     32            </transport>
     33            <message clientCredentialType="UserName" />
     34          </security>
     35        </binding>
     36        <binding name="WSHttpBinding_IAuthorizationManagementService"
     37          closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00"
     38          sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false"
     39          hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
     40          maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8"
     41          useDefaultWebProxy="true" allowCookies="false">
     42          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
     43            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
     44          <reliableSession ordered="true" inactivityTimeout="00:10:00"
     45            enabled="false" />
     46          <security mode="Message">
     47            <transport clientCredentialType="Windows" proxyCredentialType="None"
     48              realm="">
     49              <extendedProtectionPolicy policyEnforcement="Never" />
     50            </transport>
     51            <message clientCredentialType="UserName" negotiateServiceCredential="true"
     52              algorithmSuite="Default" establishSecurityContext="true" />
     53          </security>
     54        </binding>
     55      </wsHttpBinding>
     56    </bindings>
     57    <behaviors>
     58      <endpointBehaviors>
     59        <behavior name="myClientBehavior">
     60          <clientCredentials>
     61            <serviceCertificate>
     62              <authentication certificateValidationMode="Custom" customCertificateValidatorType=" UnitTests.service.MyX509Validator,UnitTests" />
     63            </serviceCertificate>
     64          </clientCredentials>
     65        </behavior>
     66      </endpointBehaviors>
    3567     
    36      
    37      
    38     </system.serviceModel>
    39     <system.web>
    40       <compilation debug="true" />
    41       <membership defaultProvider="HeuristiclabMemberShipProvider" userIsOnlineTimeWindow="15">
    42         <providers>
    43           <clear/>
    44           <add
    45             name="HeuristiclabMemberShipProvider"
    46             type="Service.Provider.HeuristicLabMembershipProvider, Service"
    47             passwordFormat= "Hashed"/>
    48         </providers>
    49       </membership>
    50     </system.web>
    51  
    52   <system.serviceModel>
    53     <behaviors>
    5468      <serviceBehaviors>
    5569        <behavior name="HttpServiceBehavior">
     70          <serviceCredentials>
     71
     72            <userNameAuthentication membershipProviderName="HeuristiclabMemberShipProvider" userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Service.Provider.HeuristicLabUsernamePasswordValidator, Service" />
     73            <serviceCertificate findValue="MyServerCert" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My" />
     74          </serviceCredentials>
    5675          <serviceMetadata httpGetEnabled="true" httpGetUrl="http://127.0.0.1:8888/metadata" />
    5776          <serviceDebug httpHelpPageUrl="http://127.0.0.1:8888/debug" />
     
    6281      <service behaviorConfiguration="HttpServiceBehavior" name="Service.Services.Administration.AuthorizationManagementService">
    6382        <endpoint address="http://127.0.0.1:8888/AuthorizationManagementEndpoint"
    64           binding="basicHttpBinding" bindingConfiguration="" contract="Service.Services.Administration.IAuthorizationManagementService" />
     83          binding="wsHttpBinding" bindingConfiguration="Binding" contract="Service.Services.Administration.IAuthorizationManagementService" />
    6584        <host>
    6685          <baseAddresses>
     
    7089      </service>
    7190    </services>
     91   
     92     
     93   
    7294  </system.serviceModel>
    7395</configuration>
  • branches/HeuristicLab.Services.Authentication Prototype/UnitTests/service/HeuristicLabManagementServiceTest.cs

    r4002 r4020  
    44using System.Linq;
    55using Microsoft.VisualStudio.TestTools.UnitTesting;
     6using System.Web.Security;
    67
    78namespace UnitTests.service {
     
    2728      }
    2829    }
     30    [TestMethod()]
    2931    public void TestCreateRoleTest() {
    30       new ServiceManagementRemote.AuthorizationManagementServiceClient().CreateRole("myRole", true);
     32      MembershipProvider provider = Membership.Provider;
     33      MembershipCreateStatus status;
     34      provider.CreateUser("testUser", "mypassword", "myMail", "question", "answer", true, null,out status);
     35      Assert.AreEqual(MembershipCreateStatus.Success, status);
     36
     37      AuthorizationManagementServiceRemote.AuthorizationManagementServiceClient client = new AuthorizationManagementServiceRemote.AuthorizationManagementServiceClient();
     38      client.ClientCredentials.UserName.UserName = "testUser";
     39      client.ClientCredentials.UserName.Password = "mypassword";
     40      client.CreateRole("roleName", true);
    3141    }
    3242
Note: See TracChangeset for help on using the changeset viewer.