Exemplo n.º 1
0
 public SubRealmService(ISubRealmRepository subRealmRepository, IPermissionRepository permissionRepository, IApplicationDataPolicyRepository applicationDataPolicyRepository, IMapper mapper)
 {
     this.subRealmRepository              = subRealmRepository;
     this.permissionRepository            = permissionRepository;
     this.applicationDataPolicyRepository = applicationDataPolicyRepository;
     this.mapper = mapper;
 }
Exemplo n.º 2
0
 public TeamService(ITeamRepository teamRepository, IApplicationDataPolicyRepository applicationDataPolicyRepository, ITermsOfServiceRepository termsOfServiceRepository, ISubRealmRepository subRealmRepository, IMapper mapper)
 {
     this.teamRepository = teamRepository;
     this.applicationDataPolicyRepository = applicationDataPolicyRepository;
     this.termsOfServiceRepository        = termsOfServiceRepository;
     this.subRealmRepository = subRealmRepository;
     this.mapper             = mapper;
 }
 public SecurityContractApplicationService(IApplicationRepository applicationRepository, IIdentityApiResourceRepository identityApiResourceRespository, IPermissionRepository permissionRepository, IApplicationFunctionRepository applicationFunctionRepository, IApplicationDataPolicyRepository applicationDataPolicyRepository)
 {
     this.applicationRepository           = applicationRepository;
     this.identityApiResourceRespository  = identityApiResourceRespository;
     this.permissionRepository            = permissionRepository;
     this.applicationFunctionRepository   = applicationFunctionRepository;
     this.applicationDataPolicyRepository = applicationDataPolicyRepository;
 }
 public SecurityContractDefaultConfigurationService(IRoleRepository roleRepository, IUserRepository userRepository, IFunctionRepository functionRepository, ITeamRepository teamRepository, IApplicationRepository applicationRepository, IApplicationDataPolicyRepository applicationDataPolicyRepository, ILdapAuthenticationModeRepository ldapAuthenticationModeRepository)
 {
     this.roleRepository                   = roleRepository;
     this.userRepository                   = userRepository;
     this.functionRepository               = functionRepository;
     this.teamRepository                   = teamRepository;
     this.applicationRepository            = applicationRepository;
     this.applicationDataPolicyRepository  = applicationDataPolicyRepository;
     this.ldapAuthenticationModeRepository = ldapAuthenticationModeRepository;
 }
 public IdentityWithAdditionalClaimsProfileService(UserManager <UserModel> userManager, IUserClaimsPrincipalFactory <UserModel> claimsFactory, ILogger <IdentityWithAdditionalClaimsProfileService> logger,
                                                   IProfileRepository profileRepository, IApplicationDataPolicyRepository applicationDataPolicyRepository, IPermissionRepository permissionRepository, ITeamRepository teamRepository)
 {
     _userManager           = userManager;
     _claimsFactory         = claimsFactory;
     Logger                 = logger;
     this.profileRepository = profileRepository;
     this.applicationDataPolicyRepository = applicationDataPolicyRepository;
     this.permissionRepository            = permissionRepository;
     this.teamRepository = teamRepository;
 }
Exemplo n.º 6
0
        public IdentityWithAdditionalClaimsProfileService_Tests()
        {
            var mockOptionsAccessor    = Substitute.For <IOptions <IdentityOptions> >();
            var mockPasswordHasher     = Substitute.For <IPasswordHasher <UserModel> >();
            var mockUserValidators     = Substitute.For <IEnumerable <IUserValidator <UserModel> > >();
            var mockPasswordValidators = Substitute.For <IEnumerable <IPasswordValidator <UserModel> > >();
            var mockKeyNormalizer      = Substitute.For <ILookupNormalizer>();
            var mockErrors             = Substitute.For <IdentityErrorDescriber>();
            var mockServices           = Substitute.For <IServiceProvider>();
            var mockUserLogger         = Substitute.For <ILogger <UserManager <UserModel> > >();
            var fakeA3SContext         = new A3SContextFake(new Microsoft.EntityFrameworkCore.DbContextOptions <A3SContext>());

            mockConfiguration = Substitute.For <IConfiguration>();
            var fakesCustomUserStore = new CustomUserStoreFake(fakeA3SContext, mockConfiguration);

            fakeUserManager = new CustomUserManagerFake(fakesCustomUserStore, mockOptionsAccessor, mockPasswordHasher, mockUserValidators, mockPasswordValidators, mockKeyNormalizer,
                                                        mockErrors, mockServices, mockUserLogger);

            mockUserClaimsPrincipalFactory = Substitute.For <IUserClaimsPrincipalFactory <UserModel> >();
            mockLogger            = Substitute.For <ILogger <IdentityWithAdditionalClaimsProfileService> >();
            mockProfileRepository = Substitute.For <IProfileRepository>();
            mockApplicationDataPolicyRepository = Substitute.For <IApplicationDataPolicyRepository>();
            mockPermissionRepository            = Substitute.For <IPermissionRepository>();
            mockTeamRepository = Substitute.For <ITeamRepository>();

            var id = Guid.NewGuid().ToString();

            profileDataRequestContext = new ProfileDataRequestContext()
            {
                Subject = new ClaimsPrincipal(new ClaimsIdentity(new Claim[]
                {
                    new Claim(ClaimTypes.Name, "example name"),
                    new Claim(ClaimTypes.NameIdentifier, id),
                    new Claim("sub", id),
                    new Claim("custom-claim", "example claim value"),
                }, "mock")),
                Client = new Client()
                {
                    ClientName = "mockClient"
                },
                RequestedClaimTypes = new List <string>()
                {
                    ClaimTypes.Name,
                    ClaimTypes.NameIdentifier,
                    "sub",
                    "custom-claim"
                },
                Caller = "mockCaller"
            };

            isActiveContext = new IsActiveContext(
                new ClaimsPrincipal(new ClaimsIdentity(new Claim[]
            {
                new Claim(ClaimTypes.Name, "example name"),
                new Claim(ClaimTypes.NameIdentifier, id),
                new Claim("sub", id),
                new Claim("custom-claim", "example claim value"),
            }, "mock")),
                new Client()
            {
                ClientName = "mockClient"
            },
                "mockCaller");

            userModel = new UserModel()
            {
                UserName  = "******",
                Id        = id,
                Email     = "temp@local",
                FirstName = "Temp",
                Surname   = "User"
            };
        }
Exemplo n.º 7
0
 public TeamService(ITeamRepository teamRepository, IApplicationDataPolicyRepository applicationDataPolicyRepository, IMapper mapper)
 {
     this.teamRepository = teamRepository;
     this.applicationDataPolicyRepository = applicationDataPolicyRepository;
     this.mapper = mapper;
 }