Esempio n. 1
0
        private static void CreateFacebookRules(ServiceManagementWrapper acsWrapper, RelyingPartyRuleGroup defaultRuleGroup)
        {
            Console.Write("Creating Facebook mapping rules....");
            var name = "Facebook";

            // pass name
            acsWrapper.AddPassThroughRuleToRuleGroup(defaultRuleGroup.RuleGroup.Name, name, ClaimTypes.Name);

            // pass nameidentifier
            acsWrapper.AddPassThroughRuleToRuleGroup(defaultRuleGroup.RuleGroup.Name, name, ClaimTypes.NameIdentifier);

            Console.WriteLine("done.");
        }
        private static void CreateYahooRules(ServiceManagementWrapper acsWrapper, RelyingPartyRuleGroup defaultRuleGroup)
        {
            Console.Write("Creating Yahoo! mapping rules....");
            var name = SocialIdentityProviders.Yahoo.HomeRealm;

            // pass name
            acsWrapper.AddPassThroughRuleToRuleGroup(defaultRuleGroup.RuleGroup.Name, name, ClaimTypes.Name);

            // pass nameidentifier
            acsWrapper.AddPassThroughRuleToRuleGroup(defaultRuleGroup.RuleGroup.Name, name, ClaimTypes.NameIdentifier);

            Console.WriteLine("done.");
        }
Esempio n. 3
0
        private static void CreateWindowsLiveRules(ServiceManagementWrapper acsWrapper, RelyingPartyRuleGroup defaultRuleGroup)
        {
            Console.Write("Creating Windows Live ID mapping rules....");

            var name = SocialIdentityProviders.WindowsLiveId.DisplayName;

            // pass nameidentifier
            acsWrapper.AddPassThroughRuleToRuleGroup(defaultRuleGroup.RuleGroup.Name, name, ClaimTypes.NameIdentifier);

            // pass name
            acsWrapper.AddPassThroughRuleToRuleGroup(defaultRuleGroup.RuleGroup.Name, name, ClaimTypes.NameIdentifier, ClaimTypes.Name);

            Console.WriteLine("done.");
        }
        private void CreateRulesForTenantWithOwnIP(string organizationInternalName, string identityProviderName, ServiceManagementWrapper acsWrapper, string ruleGroup, string adminClaimType, string adminClaimValue, string costCenterClaimType)
        {
            // name
            acsWrapper.AddPassThroughRuleToRuleGroup(ruleGroup,
                                                     identityProviderName,
                                                     ClaimTypes.Name);


            // add organization
            acsWrapper.AddSimpleRuleToRuleGroupWithoutSpecifyInputClaim(ruleGroup,
                                                                        identityProviderName,
                                                                        Fabrikam.ClaimTypes.Organization,
                                                                        organizationInternalName);

            if (!string.IsNullOrEmpty(costCenterClaimType))
            {
                // add costcenter
                acsWrapper.AddPassThroughRuleToRuleGroup(ruleGroup,
                                                         identityProviderName,
                                                         costCenterClaimType,
                                                         Fabrikam.ClaimTypes.CostCenter);
            }

            // add role
            acsWrapper.AddSimpleRuleToRuleGroup(ruleGroup,
                                                identityProviderName,
                                                adminClaimType,
                                                adminClaimValue,
                                                Microsoft.IdentityModel.Claims.ClaimTypes.Role,
                                                Fabrikam.Roles.ShipmentCreator);

            // add role
            acsWrapper.AddSimpleRuleToRuleGroup(ruleGroup,
                                                identityProviderName,
                                                adminClaimType,
                                                adminClaimValue,
                                                Microsoft.IdentityModel.Claims.ClaimTypes.Role,
                                                Fabrikam.Roles.Administrator);
        }
Esempio n. 5
0
        private static void CreateAOrderRules(ServiceManagementWrapper acsWrapper)
        {
            Console.Write(string.Format("Creating {0} mapping rules....", AOrderRelyingParty));

            var relyingParty     = acsWrapper.RetrieveRelyingParties().Single(rp => rp.Name == AOrderRelyingParty);
            var defaultRuleGroup = relyingParty.RelyingPartyRuleGroups.FirstOrDefault();

            // remove rules
            acsWrapper.RemoveAllRulesInGroup(defaultRuleGroup.RuleGroup.Name);

            // add cost center
            acsWrapper.AddPassThroughRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                LitwareIdentityProvider,
                Litware.ClaimTypes.CostCenter,
                Litware.ClaimTypes.CostCenter);

            // country
            acsWrapper.AddPassThroughRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                LitwareIdentityProvider,
                ClaimTypes.Country,
                ClaimTypes.Country);

            // given name
            acsWrapper.AddPassThroughRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                LitwareIdentityProvider,
                ClaimTypes.GivenName,
                ClaimTypes.GivenName);

            // pass name
            acsWrapper.AddPassThroughRuleToRuleGroup(defaultRuleGroup.RuleGroup.Name, LitwareIdentityProvider, ClaimTypes.Name);

            // add organization
            acsWrapper.AddSimpleRuleToRuleGroupWithoutSpecifyInputClaim(
                defaultRuleGroup.RuleGroup.Name,
                LitwareIdentityProvider,
                Adatum.ClaimTypes.Organization,
                "Litware");

            // add role
            acsWrapper.AddPassThroughRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                LitwareIdentityProvider,
                AllOrganizations.ClaimTypes.Group,
                ClaimTypes.Role);

            // state or province
            acsWrapper.AddPassThroughRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                LitwareIdentityProvider,
                ClaimTypes.StateOrProvince,
                ClaimTypes.StateOrProvince);

            // street address
            acsWrapper.AddPassThroughRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                LitwareIdentityProvider,
                ClaimTypes.StreetAddress,
                ClaimTypes.StreetAddress);

            // surname
            acsWrapper.AddPassThroughRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                LitwareIdentityProvider,
                ClaimTypes.Surname,
                ClaimTypes.Surname);

            Console.WriteLine("done.");
        }
        private static void CreateAdatumRules(ServiceManagementWrapper acsWrapper)
        {
            Console.Write("Creating Adatum.7 mapping rules....");

            var relyingParty         = acsWrapper.RetrieveRelyingParties().Single(rp => rp.Name == "Adatum");
            var defaultRuleGroup     = relyingParty.RelyingPartyRuleGroups.FirstOrDefault();
            var identityProviderName = AdatumIdentityProvider;

            // remove rules
            acsWrapper.RemoveAllRulesInGroup(defaultRuleGroup.RuleGroup.Name);

            // pass name
            acsWrapper.AddPassThroughRuleToRuleGroup(defaultRuleGroup.RuleGroup.Name, identityProviderName, ClaimTypes.Name);

            // transform organization
            acsWrapper.AddPassThroughRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                identityProviderName,
                Adatum.ClaimTypes.Organization,
                Fabrikam.ClaimTypes.Organization);

            // add cost center
            acsWrapper.AddPassThroughRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                identityProviderName,
                Adatum.ClaimTypes.CostCenter,
                Fabrikam.ClaimTypes.CostCenter);

            // add role
            acsWrapper.AddSimpleRuleToRuleGroupWithoutSpecifyInputClaim(
                defaultRuleGroup.RuleGroup.Name,
                identityProviderName,
                ClaimTypes.Role,
                Fabrikam.Roles.ShipmentCreator);


            // given name
            acsWrapper.AddPassThroughRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                identityProviderName,
                ClaimTypes.GivenName,
                ClaimTypes.GivenName);

            // surname
            acsWrapper.AddPassThroughRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                identityProviderName,
                ClaimTypes.Surname,
                ClaimTypes.Surname);

            // street address
            acsWrapper.AddPassThroughRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                identityProviderName,
                ClaimTypes.StreetAddress,
                ClaimTypes.StreetAddress);


            // state or province
            acsWrapper.AddPassThroughRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                identityProviderName,
                ClaimTypes.StateOrProvince,
                ClaimTypes.StateOrProvince);


            // country
            acsWrapper.AddPassThroughRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                identityProviderName,
                ClaimTypes.Country,
                ClaimTypes.Country);

            Console.WriteLine("done.");
        }