Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4021


Ignore:
Timestamp:
07/08/10 23:13:56 (14 years ago)
Author:
bfarka
Message:
 
Location:
branches/HeuristicLab.Services.Authentication Prototype
Files:
6 edited

Legend:

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

    r4020 r4021  
    88          <add
    99            name="HeuristiclabMemberShipProvider"
    10             type="Service.Provider.HeuristicLabMembershipProvider, Service"
     10            type="Service.Provider.HeuristicLabRoleProvider, Service"
     11            applicationName="HeuristicLabServices"
    1112            passwordFormat= "Hashed"/>
    1213        </providers>
    1314      </membership>
     15    <roleManager enabled ="true"
     16   defaultProvider ="HeuristicLabRoleProvider" >
     17      <providers>
     18        <clear/>
     19        <add name ="HeuristicLabRoleProvider"
     20          type="Service.Provider.HeuristicLabRoleProivder, Service"
     21          applicationName="HeuristiclLabServices"/>
     22      </providers>
     23    </roleManager>
     24
    1425  </system.web>
    1526  <system.serviceModel>
     
    2738      <serviceBehaviors>
    2839        <behavior name="HttpServiceBehavior">
     40          <serviceAuthorization principalPermissionMode ="UseAspNetRoles"
     41                        roleProviderName ="HeuristicLabRoleProvider" />
    2942          <serviceCredentials>
    30            
    3143            <userNameAuthentication membershipProviderName="HeuristiclabMemberShipProvider" userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Service.Provider.HeuristicLabUsernamePasswordValidator, Service" />
    3244            <!-- the name and store of the certificate has to be customized for each server to run-->
  • branches/HeuristicLab.Services.Authentication Prototype/Service/Services/Administration/AuthorizationManagementService.cs

    r3976 r4021  
    33using System.Linq;
    44using System.Text;
     5using System.Security.Permissions;
    56
    67namespace Service.Services.Administration {
     
    89    #region IAuthorizationManagementService Member
    910
     11   
    1012    public void CreateRole(string roleName, bool isPermission) {
    1113      new Service.Provider.HeuristicLabRoleProvider().CreateRole(roleName, isPermission);
  • branches/HeuristicLab.Services.Authentication Prototype/Service/Services/Administration/IAuthorizationManagementService.cs

    r3971 r4021  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    5 using System.ServiceModel;
     1using System.ServiceModel;
     2using System.Security.Permissions;
    63
    74namespace Service.Services.Administration {
     
    107
    118    [OperationContract]
     9    [PrincipalPermission(SecurityAction.PermitOnly, Role = "Admin")]
    1210    void CreateRole(string roleName, bool isPermission);
    1311
  • branches/HeuristicLab.Services.Authentication Prototype/UnitTests/app.config

    r4020 r4021  
    33  <system.web>
    44    <compilation debug="true" />
     5    <roleManager enabled ="true"
     6   defaultProvider ="HeuristicLabRoleProvider" >
     7      <providers>
     8
     9        <add name ="HeuristicLabRoleProvider"
     10          type="Service.Provider.HeuristicLabRoleProvider, Service"
     11          applicationName="HeuristiclLabServices"/>
     12      </providers>
     13    </roleManager>
    514    <membership defaultProvider="HeuristiclabMemberShipProvider" userIsOnlineTimeWindow="15">
    615      <providers>
     
    6877      <serviceBehaviors>
    6978        <behavior name="HttpServiceBehavior">
     79          <serviceAuthorization principalPermissionMode ="UseAspNetRoles"
     80                        roleProviderName ="HeuristicLabRoleProvider" />
    7081          <serviceCredentials>
    71 
    7282            <userNameAuthentication membershipProviderName="HeuristiclabMemberShipProvider" userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Service.Provider.HeuristicLabUsernamePasswordValidator, Service" />
    7383            <serviceCertificate findValue="MyServerCert" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My" />
  • branches/HeuristicLab.Services.Authentication Prototype/UnitTests/service/AbstractHeuristicLabServiceTest.cs

    r3976 r4021  
    2020
    2121    [TestCleanup()]
    22     public virtual void closeDBConnection() {
     22    public override void closeDBConnection() {
    2323      sh.Close();
    2424      base.closeDBConnection();
  • branches/HeuristicLab.Services.Authentication Prototype/UnitTests/service/HeuristicLabManagementServiceTest.cs

    r4020 r4021  
    55using Microsoft.VisualStudio.TestTools.UnitTesting;
    66using System.Web.Security;
     7using Service.Provider;
    78
    89namespace UnitTests.service {
     
    3435      provider.CreateUser("testUser", "mypassword", "myMail", "question", "answer", true, null,out status);
    3536      Assert.AreEqual(MembershipCreateStatus.Success, status);
     37      HeuristicLabRoleProvider roleProvider = new HeuristicLabRoleProvider();
     38      roleProvider.CreateRole("Admin");
     39      roleProvider.AddUsersToRoles(new String[1]{"testUser"},new String[1]{"Admin"});
    3640
    3741      AuthorizationManagementServiceRemote.AuthorizationManagementServiceClient client = new AuthorizationManagementServiceRemote.AuthorizationManagementServiceClient();
     
    3943      client.ClientCredentials.UserName.Password = "mypassword";
    4044      client.CreateRole("roleName", true);
     45      roleProvider.RemoveUsersFromRoles(new String[1] { "testUser" }, new String[1] { "Admin" });
     46      try {
     47        client.CreateRole("roleName", true);
     48        Assert.Fail();
     49      }
     50      catch (Exception) {
     51        //should throw exception
     52      }
     53
     54
    4155    }
    4256
Note: See TracChangeset for help on using the changeset viewer.