コード例 #1
0
        public static void CreateRelyingPartysWithRules(ServiceManagementWrapper acsWrapper)
        {
            var relyingPartyName = "Adatum.SimulatedIssuer.6";

            var ips = new[] { SocialIdentityProviders.WindowsLiveId.DisplayName, SocialIdentityProviders.Google.DisplayName, "Facebook" };

            Console.Write(string.Format("Creating {0} relying party....", relyingPartyName));
            var realmAddress = "https://localhost/Adatum.FederationProvider.6/";
            var replyAddress = "https://localhost/Adatum.FederationProvider.6/Federation.aspx";
            var ruleGroup    = string.Format("Default role group for {0}", relyingPartyName);


            acsWrapper.AddRelyingParty(relyingPartyName, realmAddress, replyAddress, null, null, null, ruleGroup, ips);

            Console.WriteLine("done");


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

            acsWrapper.RemoveAllRulesInGroup(defaultRuleGroup.RuleGroup.Name);

            // Social IPs
            CreateGoogleRules(acsWrapper, defaultRuleGroup);
            CreateFacebookRules(acsWrapper, defaultRuleGroup);
            CreateWindowsLiveRules(acsWrapper, defaultRuleGroup);
        }
コード例 #2
0
        private static void CreateContosoRules(ServiceManagementWrapper acsWrapper)
        {
            Console.Write("Creating Contoso mapping rules....");

            var identityProviderName = "Windows Live ID";
            var relyingParty         = acsWrapper.RetrieveRelyingParties().Single(rp => rp.Name == "Contoso");
            var defaultRuleGroup     = relyingParty.RelyingPartyRuleGroups.FirstOrDefault();

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

            // add name
            acsWrapper.AddSimpleRuleToRuleGroup(
                defaultRuleGroup.RuleGroup.Name,
                identityProviderName,
                ClaimTypes.NameIdentifier,
                null,
                ClaimTypes.Name,
                "rick");

            // add organization
            acsWrapper.AddSimpleRuleToRuleGroupWithoutSpecifyInputClaim(
                defaultRuleGroup.RuleGroup.Name,
                identityProviderName,
                Fabrikam.ClaimTypes.Organization,
                "Contoso");

            // add cost center
            acsWrapper.AddSimpleRuleToRuleGroupWithoutSpecifyInputClaim(
                defaultRuleGroup.RuleGroup.Name,
                identityProviderName,
                Fabrikam.ClaimTypes.CostCenter,
                Contoso.CostCenters.SingleCostCenter);

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

            // given name
            acsWrapper.AddSimpleRuleToRuleGroupWithoutSpecifyInputClaim(
                defaultRuleGroup.RuleGroup.Name,
                identityProviderName,
                ClaimTypes.GivenName,
                "Rick");

            // surname
            acsWrapper.AddSimpleRuleToRuleGroupWithoutSpecifyInputClaim(defaultRuleGroup.RuleGroup.Name,
                                                                        identityProviderName,
                                                                        ClaimTypes.Surname,
                                                                        "Rico");
            Console.WriteLine("done.");
        }
コード例 #3
0
        private static void CreateEnrollmentRules(ServiceManagementWrapper acsWrapper)
        {
            var name = "f-Shipping.Enrollment.7";

            var rp = acsWrapper.RetrieveRelyingParties().Single(r => r.Name == name);
            var defaultRuleGroup = rp.RelyingPartyRuleGroups.FirstOrDefault();

            acsWrapper.RemoveAllRulesInGroup(defaultRuleGroup.RuleGroup.Name);

            // Social IP
            CreateGoogleRules(acsWrapper, defaultRuleGroup);
            CreateYahooRules(acsWrapper, defaultRuleGroup);
            CreateWindowsLiveRules(acsWrapper, defaultRuleGroup);
        }
コード例 #4
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.");
        }
コード例 #5
0
        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.");
        }