Changeset 4021 for branches/HeuristicLab.Services.Authentication Prototype
- Timestamp:
- 07/08/10 23:13:56 (14 years ago)
- Location:
- branches/HeuristicLab.Services.Authentication Prototype
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Services.Authentication Prototype/Service/App.config
r4020 r4021 8 8 <add 9 9 name="HeuristiclabMemberShipProvider" 10 type="Service.Provider.HeuristicLabMembershipProvider, Service" 10 type="Service.Provider.HeuristicLabRoleProvider, Service" 11 applicationName="HeuristicLabServices" 11 12 passwordFormat= "Hashed"/> 12 13 </providers> 13 14 </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 14 25 </system.web> 15 26 <system.serviceModel> … … 27 38 <serviceBehaviors> 28 39 <behavior name="HttpServiceBehavior"> 40 <serviceAuthorization principalPermissionMode ="UseAspNetRoles" 41 roleProviderName ="HeuristicLabRoleProvider" /> 29 42 <serviceCredentials> 30 31 43 <userNameAuthentication membershipProviderName="HeuristiclabMemberShipProvider" userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Service.Provider.HeuristicLabUsernamePasswordValidator, Service" /> 32 44 <!-- 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 3 3 using System.Linq; 4 4 using System.Text; 5 using System.Security.Permissions; 5 6 6 7 namespace Service.Services.Administration { … … 8 9 #region IAuthorizationManagementService Member 9 10 11 10 12 public void CreateRole(string roleName, bool isPermission) { 11 13 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; 1 using System.ServiceModel; 2 using System.Security.Permissions; 6 3 7 4 namespace Service.Services.Administration { … … 10 7 11 8 [OperationContract] 9 [PrincipalPermission(SecurityAction.PermitOnly, Role = "Admin")] 12 10 void CreateRole(string roleName, bool isPermission); 13 11 -
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/app.config
r4020 r4021 3 3 <system.web> 4 4 <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> 5 14 <membership defaultProvider="HeuristiclabMemberShipProvider" userIsOnlineTimeWindow="15"> 6 15 <providers> … … 68 77 <serviceBehaviors> 69 78 <behavior name="HttpServiceBehavior"> 79 <serviceAuthorization principalPermissionMode ="UseAspNetRoles" 80 roleProviderName ="HeuristicLabRoleProvider" /> 70 81 <serviceCredentials> 71 72 82 <userNameAuthentication membershipProviderName="HeuristiclabMemberShipProvider" userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Service.Provider.HeuristicLabUsernamePasswordValidator, Service" /> 73 83 <serviceCertificate findValue="MyServerCert" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My" /> -
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/service/AbstractHeuristicLabServiceTest.cs
r3976 r4021 20 20 21 21 [TestCleanup()] 22 public virtualvoid closeDBConnection() {22 public override void closeDBConnection() { 23 23 sh.Close(); 24 24 base.closeDBConnection(); -
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/service/HeuristicLabManagementServiceTest.cs
r4020 r4021 5 5 using Microsoft.VisualStudio.TestTools.UnitTesting; 6 6 using System.Web.Security; 7 using Service.Provider; 7 8 8 9 namespace UnitTests.service { … … 34 35 provider.CreateUser("testUser", "mypassword", "myMail", "question", "answer", true, null,out status); 35 36 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"}); 36 40 37 41 AuthorizationManagementServiceRemote.AuthorizationManagementServiceClient client = new AuthorizationManagementServiceRemote.AuthorizationManagementServiceClient(); … … 39 43 client.ClientCredentials.UserName.Password = "mypassword"; 40 44 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 41 55 } 42 56
Note: See TracChangeset
for help on using the changeset viewer.