コード例 #1
1
    private SimpleWebToken CreateToken(ClaimCollection claims, string issuerName, string appliesTo)
    {
        appliesTo = appliesTo.ToLower();

        var sKey = ConfigurationManager.AppSettings[appliesTo];
        if (String.IsNullOrEmpty(sKey))
        {
            //check if appliesTo failed to find the key because it's missing a trailing slash,
            //or because it has a trailing slash which shouldn't be there
            //and act accordingly (and try again):
            if (!appliesTo.EndsWith("/"))
                appliesTo += "/";
            else
                appliesTo = VirtualPathUtility.RemoveTrailingSlash(appliesTo);

            sKey = ConfigurationManager.AppSettings[appliesTo];
            if (String.IsNullOrEmpty(sKey))
                throw new ConfigurationException(String.Format("Missing symmetric key for \"{0}\".", appliesTo));
        }
        var key = this.HexToByte(sKey);

        var sb = new StringBuilder();
        foreach (var c in claims)
            sb.AppendFormat("{0}={1}&", HttpUtility.UrlEncode(c.ClaimType), HttpUtility.UrlEncode(c.Value));

        double lifeTimeInSeconds = 3600;
        sb
            .AppendFormat("TokenId={0}&", HttpUtility.UrlEncode(Guid.NewGuid().ToString()))
            .AppendFormat("Issuer={0}&", HttpUtility.UrlEncode(issuerName))
            .AppendFormat("Audience={0}&", HttpUtility.UrlEncode(appliesTo))
            .AppendFormat("ExpiresOn={0:0}", (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds + lifeTimeInSeconds);

        var unsignedToken = sb.ToString();

        var hmac = new HMACSHA256(key);
        var sig = hmac.ComputeHash(Encoding.ASCII.GetBytes(unsignedToken));

        string signedToken = String.Format("{0}&HMACSHA256={1}",
            unsignedToken,
            HttpUtility.UrlEncode(Convert.ToBase64String(sig)));

        return new SimpleWebToken(signedToken);
    }
 static public IEnumerable <Claim> Convert(ClaimCollection claims)
 {
     foreach (v1Claim claim in claims)
     {
         yield return(new Claim(claim.ClaimType, claim.Value, claim.ValueType, claim.Issuer, claim.OriginalIssuer));
     }
 }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Convert to an IClaimPrincipal so we can access Claims properties
            IClaimsPrincipal claimsPrincipal = (IClaimsPrincipal)this.User;

            // Get collection of claims
            ClaimCollection claims   = claimsPrincipal.Identities[0].Claims;
            StringBuilder   sbClaims = new StringBuilder();

            // Iterate through claims, build list for rendering to UI
            foreach (Claim claim in claims)
            {
                if (claim.ClaimType.Contains("identityprovider"))
                {
                    lblIdP.Text = claim.Value;
                }
                sbClaims.AppendLine(claim.ClaimType + ": " + claim.Value);
            }
            lblClaims.Text = sbClaims.ToString();

            // check to see if the user is in the admin role
            if (User.IsInRole("admin"))
            {
                EnableAdminAccess();
            }
        }
 static public IEnumerable<Claim> Convert( ClaimCollection claims )
 {
     foreach ( v1Claim claim in claims )
     {
         yield return new Claim( claim.ClaimType, claim.Value, claim.ValueType, claim.Issuer, claim.OriginalIssuer );
     }
 }
コード例 #5
0
ファイル: UserAccount.cs プロジェクト: vcardins/gasprice
 public void AddClaim(UserClaim item)
 {
     ClaimCollection.Add(new UserClaim
     {
         UserId = UserId,
         Type   = item.Type,
         Value  = item.Value
     });
 }
        public void TestThatIssueAppendsClaimsToCallingClaimsPrincipal(string trustedUri, string identityCertificate, string mailAddress, int expectedAppendedClaims)
        {
            var fixture = new Fixture();

            var identifyMock = MockRepository.GenerateMock <IIdentity>();

            identifyMock.Expect(m => m.Name)
            .Return(fixture.Create <string>())
            .Repeat.Any();
            identifyMock.Expect(m => m.IsAuthenticated)
            .Return(true)
            .Repeat.Any();

            var claimsIdentityMock = MockRepository.GenerateMock <IClaimsIdentity>();
            var claimsCollection   = new ClaimCollection(claimsIdentityMock)
            {
                new Claim(ClaimTypes.Email, mailAddress)
            };

            claimsIdentityMock.Stub(m => m.Claims)
            .Return(claimsCollection)
            .Repeat.Any();

            var claimsIdentityCollection = new ClaimsIdentityCollection(new List <IClaimsIdentity> {
                claimsIdentityMock
            });
            var claimPrincipalMock = MockRepository.GenerateMock <IClaimsPrincipal>();

            claimPrincipalMock.Stub(m => m.Identity)
            .Return(identifyMock)
            .Repeat.Any();
            claimPrincipalMock.Stub(m => m.Identities)
            .Return(claimsIdentityCollection)
            .Repeat.Any();

            var basicSecurityTokenService = new BasicSecurityTokenService(new BasicSecurityTokenServiceConfiguration());

            Assert.That(basicSecurityTokenService, Is.Not.Null);

            var request = new RequestSecurityToken
            {
                AppliesTo = new EndpointAddress(new Uri(trustedUri), new X509CertificateEndpointIdentity(TestHelper.GetCertificate(identityCertificate)), new AddressHeaderCollection())
            };

            var response = basicSecurityTokenService.Issue(claimPrincipalMock, request);

            Assert.That(response, Is.Not.Null);

            Assert.That(claimsCollection.Count, Is.EqualTo(1 + expectedAppendedClaims));
        }
        protected override void EstablishContext()
        {
            claimsIdentity = mocks.Stub<IClaimsIdentity>();
            
            suppliedClaims = GetDefaultClaims(IncludeLeaClaim(), IncludeLeaCodeClaim());
            suppliedClaimsCollect = new ClaimCollection(claimsIdentity);
            suppliedClaimsCollect.AddRange(suppliedClaims);

            identityCollection = new ClaimsIdentityCollection(Enumerable.Repeat(claimsIdentity, 1));

            Expect.Call(claimsIdentity.Claims).Return(suppliedClaimsCollect);
            principal = mocks.Stub<IClaimsPrincipal>();

            Expect.Call(principal.Identity).Return(claimsIdentity);
            Expect.Call(principal.Identities).Return(identityCollection);
        }
コード例 #8
0
        private string GenerateToken(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new InvalidOperationException("Name is not specified.");
            }

            var claims = new ClaimCollection
            {
                { ClaimTypes.Name, name }
            };

            var tokenBuilder = new TokenBuilder()
                               .AddClaims(claims)
                               .AddSecret(_appSettings.Secret)
                               .Expires(DateTime.Now.AddMinutes(60));

            return(tokenBuilder.Build().ToString());
        }
コード例 #9
0
        protected override void MapCore(User user, ClaimCollection claimCollection)
        {
            Assert.ArgumentNotNull((object)user, nameof(user));
            Assert.ArgumentNotNull((object)claimCollection, nameof(claimCollection));

            base.MapCore(user, claimCollection);

            var isAdminGroup     = claimCollection.Any(e => e.Value.Contains("2ea20d7b-4cd3-4a36-b760-39208ef50290"));
            var isOktaAdminGroup = claimCollection.Any(e => e.Value.Contains("OktaAdmins"));
            var claim            = claimCollection.Single(e => e.Type == "idp");
            var isAzureAd        = claim.Value == AzureAdClaimName;
            var isOkta           = claim.Value == OktaClaimName;

            if (isAzureAd)
            {
                if (!user.RuntimeSettings.IsVirtual && (isAdminGroup))
                {
                    if (MainUtil.GetBool(user.Profile.GetCustomProperty("IsAdminMapped"), false))
                    {
                        user.Profile.RemoveCustomProperty("IsAdminMapped");
                    }

                    user.Profile.IsAdministrator = true;
                    user.Profile.SetCustomProperty("IsAdminMapped", "True");
                }
            }
            else if (isOkta)
            {
                if (isOktaAdminGroup)
                {
                    if (MainUtil.GetBool(user.Profile.GetCustomProperty("IsAdminMapped"), false))
                    {
                        user.Profile.RemoveCustomProperty("IsAdminMapped");
                    }

                    user.Profile.IsAdministrator = true;
                    user.Profile.SetCustomProperty("IsAdminMapped", "True");
                }
            }


            user.Profile.Save();
        }
コード例 #10
0
        public void ClaimCollectionTest()
        {
            var a          = new ClaimDescriptor("a", "b", "c", "d", "e");
            var b          = new ClaimDescriptor("a", "b", "c", "d", "e");
            var c          = new ClaimDescriptor("x", "b", "c", "d", "e");
            var collection = new ClaimCollection(null, null, null, null);

            Assert.Equal(ClaimTypes.Name, collection.NameClaimType);
            Assert.Equal(ClaimTypes.Role, collection.RoleClaimType);
            Assert.Null(collection.AuthenticationType);
            var count = collection.Count;

            Assert.Equal(0, count);
            Assert.True(HashSet <ClaimDescriptor> .CreateSetComparer().Equals(new HashSet <ClaimDescriptor>(collection), new HashSet <ClaimDescriptor>()));
            Assert.True(HashSet <ClaimDescriptor> .CreateSetComparer().Equals(
                            new HashSet <ClaimDescriptor>(collection),
                            new HashSet <ClaimDescriptor>(Assert.IsType <ClaimCollection>(Deserialize(Serialize(collection))))
                            ));
            collection = new ClaimCollection(new [] { a, c });
            Assert.Contains(a, collection);
            Assert.Contains(c, collection);
            Assert.Equal(ClaimTypes.Name, collection.NameClaimType);
            Assert.Equal(ClaimTypes.Role, collection.RoleClaimType);
            Assert.Equal(2, collection.Count);
            Assert.True(HashSet <ClaimDescriptor> .CreateSetComparer().Equals(new HashSet <ClaimDescriptor>(collection), new HashSet <ClaimDescriptor>(new [] { a, c })));

            Assert.True(HashSet <ClaimDescriptor> .CreateSetComparer().Equals(
                            new HashSet <ClaimDescriptor>(collection),
                            new HashSet <ClaimDescriptor>(Assert.IsType <ClaimCollection>(Deserialize(Serialize(collection))))
                            ));

            collection = new ClaimCollection(new [] { a, b, c });
            Assert.Contains(a, collection);
            Assert.Contains(c, collection);
            Assert.Equal(ClaimTypes.Name, collection.NameClaimType);
            Assert.Equal(ClaimTypes.Role, collection.RoleClaimType);
            Assert.Equal(2, collection.Count);
            Assert.True(HashSet <ClaimDescriptor> .CreateSetComparer().Equals(new HashSet <ClaimDescriptor>(collection), new HashSet <ClaimDescriptor>(new [] { a, c })));

            Assert.True(collection.HasClaim(x => x.Equals(a)));
            Assert.True(collection.HasClaim(x => x.Equals(b)));
        }
コード例 #11
0
        public static string GetValue(this ClaimCollection claims, string claimType)
        {
            var claim = claims.SingleOrDefault(x => x.ClaimType == claimType);

            return(claim == null ? null : claim.Value);
        }
コード例 #12
0
        public void BaseControllerTestInitialize()
        {
            var claims = new List <Claim>
            {
                new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", "SHPF"),
                new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", "SPF"),
                new Claim("http://schemas.alcoa.com/claims/app", "SHPF"),
                new Claim("http://schemas.alcoa.com/claims/app/mnemonic", "SHPF|SPF"),
                new Claim("http://schemas.alcoa.com/claims/app/profile", "SHPF|1"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group", "SHPF|1|Itens de Estoque"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/currentlevel", "SHPF|1|Itens de Estoque|6"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/order", "SHPF|1|Itens de Estoque|5"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/sublevels", "SHPF|1|Itens de Estoque|8|7"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Itens de Estoque|Envio de Itens para  o Certificado de Análise"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Itens de Estoque|Envio de Itens para  o Certificado de Análise|/Producao/ItensEstoque/EnvioItensCertificado/EnvioItensCertificado.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group", "SHPF|1|Inventário"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/currentlevel", "SHPF|1|Inventário|8"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/order", "SHPF|1|Inventário|6"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Inventário|Pesquisa de Inconsistência"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Inventário|Pesquisa de Inconsistência|/Producao/ItensEstoque/Inventario/PesquisaInconsistencia/InventarioPesquisaInconsistencia.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group", "SHPF|1|Produção"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/currentlevel", "SHPF|1|Produção|3"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/parentlevel", "SHPF|1|Produção|0"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/order", "SHPF|1|Produção|3"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/sublevels", "SHPF|1|Produção|6|9|10|11|5"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Produção|Manutenção de Cadinhos Fábrica de Pó"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Produção|Manutenção de Cadinhos Fábrica de Pó|/SHPF/Producao/ManutencaoCadinhoFPO/ManutencaoCadinhoFPO.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Produção|Recebimento de Cadinhos Fábrica de Pó"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Produção|Recebimento de Cadinhos Fábrica de Pó|/Producao/RecebeCadinhoFPO/RecebeCadinhoFPO.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Produção|Consulta de Produção e Laboratório"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Produção|Consulta de Produção e Laboratório|/Laboratorio/AprovacaoAnalise/AprovacaoAnalise.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group", "SHPF|1|Apoio"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/currentlevel", "SHPF|1|Apoio|1"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/parentlevel", "SHPF|1|Apoio|0"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/order", "SHPF|1|Apoio|1"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Apoio|Manutenção de Warehouse x Usuários"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Apoio|Manutenção de Warehouse x Usuários|/Apoio/CadastroWarehouseUsuarios.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Itens de Estoque|Manutenção de Itens"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Itens de Estoque|Manutenção de Itens|/Producao/ItensEstoque/ManutencaoItensEstoque/PesquisaItensEstoque.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Itens de Estoque|Registro de Produção Sow - Alumar"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Itens de Estoque|Registro de Produção Sow - Alumar|/Producao/ItensEstoque/RegistroProducaoSowAlumar/RegistroProducaoSowAlumar.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group", "SHPF|1|Transferências"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/currentlevel", "SHPF|1|Transferências|7"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/order", "SHPF|1|Transferências|5"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Transferências|Altera Status Interface"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Transferências|Altera Status Interface|/Producao/ItensEstoque/AlterarStatusInterface/AlterarStatusInterface.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Transferências|Transferência Individual de Itens para o EBS"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Transferências|Transferência Individual de Itens para o EBS|/Producao/ItensEstoque/TransferenciaIndividual/TransferenciaIndividual.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Transferências|Transferência em Lote de Itens para o EBS"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Transferências|Transferência em Lote de Itens para o EBS|/Producao/ItensEstoque/TransferenciaEmLote/TransferenciaEmLote.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group", "SHPF|1|Balanças"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/currentlevel", "SHPF|1|Balanças|9"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/order", "SHPF|1|Balanças|6"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Balanças|Consulta de Aferição"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Balanças|Consulta de Aferição|/Producao/Consulta/Balanca/ConsultaAfericao.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Balanças|Cadastro de Balança"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Balanças|Cadastro de Balança|/Producao/Balanca/CadastrodeBalancas.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group", "SHPF|1|Kanban"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/currentlevel", "SHPF|1|Kanban|10"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/order", "SHPF|1|Kanban|6"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Kanban|Tipo"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Kanban|Tipo|/Producao/Kanban/TipoKanban/CadastroDeTiposKanban.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Kanban|Recurso"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Kanban|Recurso|/Producao/Kanban/Recurso/CadastroDeRecursos.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Kanban|Produto"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Kanban|Produto|/Producao/Kanban/ProdutoKanban/CadastroProdutosKanban.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group", "SHPF|1|Relatórios"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/currentlevel", "SHPF|1|Relatórios|11"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/order", "SHPF|1|Relatórios|6"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Relatórios|Itens de Estoque por Família de Produto"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Relatórios|Itens de Estoque por Família de Produto|/Producao/Relatorios/ItensEstoquePorFamilia/ItensEstoquePorFamilia.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Relatórios|Itens de Estoque por Cliente / Produto"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Relatórios|Itens de Estoque por Cliente / Produto|/Producao/Relatorios/ItensEstoquePorClienteProduto/ItensEstoquePorClienteProduto.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Relatórios|Análises por Lote / Corrida"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Relatórios|Análises por Lote / Corrida|/Producao/Relatorios/AnalisesPorLoteCorrida/AnalisesPorLoteCorrida.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Relatórios|Estoque - Resumo por Ordem de Produção"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Relatórios|Estoque - Resumo por Ordem de Produção|/Producao/Relatorios/ResumoPorOrdemDeProducao/ResumoPorOrdemDeProducao.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Relatórios|Estoque de Venda - Resumo por Localização"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Relatórios|Estoque de Venda - Resumo por Localização|/Producao/Relatorios/ResumoPorLocalizacao/ResumoPorLocalizacao.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group", "SHPF|1|Programação de Produção"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/currentlevel", "SHPF|1|Programação de Produção|5"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/order", "SHPF|1|Programação de Produção|4"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Programação de Produção|Manutenção por Número de Produção"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Programação de Produção|Manutenção por Número de Produção|/Producao/ManutencaoProducao/ManutencaoProducao.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Programação de Produção|Sem planejamento EBS"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Programação de Produção|Sem planejamento EBS|/Producao/ProgramacaoSemPlanejamento/PesquisaProducaoSemPlanejamento.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Programação de Produção|Com Planejamento EBS"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Programação de Produção|Com Planejamento EBS|/Producao/ProgramacaoComPlanejamento/PesquisaProducaoComPlanejamento.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Inventário|Manutenção"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Inventário|Manutenção|/Producao/ItensEstoque/Inventario/Manutencao/Inventario.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Itens de Estoque|Troca da Ordem de Produção"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Itens de Estoque|Troca da Ordem de Produção|/Producao/ItensEstoque/TrocaOrdemProducao/TrocaOrdemProducao.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Itens de Estoque|Sucateamento"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Itens de Estoque|Sucateamento|/Producao/ItensEstoque/Sucateamento/Sucateamento.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Itens de Estoque|Retirada do Estoque de Venda"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Itens de Estoque|Retirada do Estoque de Venda|/Producao/ItensEstoque/RetiradaEBS/RetiradaEBS.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Itens de Estoque|Reimpressão de Etiquetas"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Itens de Estoque|Reimpressão de Etiquetas|/Producao/ItensEstoque/ReimpressaoEtiqueta/ReimpressaoEtiqueta.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Itens de Estoque|Reclassificação"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Itens de Estoque|Reclassificação|/Producao/ItensEstoque/Reclassificacao/Reclassificacao.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Itens de Estoque|Mudança de Localização"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Itens de Estoque|Mudança de Localização|/Producao/ItensEstoque/Realocacao/Realocacao.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Itens de Estoque|Alterar Status Item"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Itens de Estoque|Alterar Status Item|/Producao/ItensEstoque/AlterarStatusItem/AlterarStatusItem.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Itens de Estoque|Item Substituto"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Itens de Estoque|Item Substituto|/Producao/ItensEstoque/ItemSubstituto/ItemSubstituto.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|1|Itens de Estoque|Apontamento de Ingredientes"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|1|Itens de Estoque|Apontamento de Ingredientes|/Producao/ItensEstoque/ApontamentoIngredientes/ApontamentoIngredientes.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile", "SHPF|2"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group", "SHPF|2|Apoio"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/currentlevel", "SHPF|2|Apoio|1"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/parentlevel", "SHPF|2|Apoio|0"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/order", "SHPF|2|Apoio|1"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|2|Apoio|Manutenção de Warehouse x Usuários"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|2|Apoio|Manutenção de Warehouse x Usuários|/Apoio/CadastroWarehouseUsuarios.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|2|Apoio|Parâmetros do Sistema"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|2|Apoio|Parâmetros do Sistema|/Apoio/ParametrosDoSistema.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|2|Apoio|Parâmetros do Sistema - Romaneio"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|2|Apoio|Parâmetros do Sistema - Romaneio|/Geral/ParametrosRomaneio/ParametrosRomaneio.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service", "SHPF|2|Apoio|Reiniciar Sessão"),
                new Claim("http://schemas.alcoa.com/claims/app/profile/group/service/url", "SHPF|2|Apoio|Reiniciar Sessão|/Geral/Sessao/ReiniciarSessao.aspx"),
                new Claim("http://schemas.alcoa.com/claims/app/profile", "SHPF|3"),
                new Claim("http://schemas.alcoa.com/claims/app/profile", "SHPF|4"),
            };

            UserClaims = new ClaimsIdentity(claims, "Kerberos").Claims;
        }
コード例 #13
0
ファイル: ClaimsTransformer.cs プロジェクト: nordseth/blog
 private IEnumerable<SimpleClaim> ToSimpleClaim(string id, ClaimCollection claimCollection)
 {
     return claimCollection.Select(c => new SimpleClaim
     {
         Subject = id,
         ClaimType = c.ClaimType,
         Issuer = c.Issuer,
         Value = c.Value,
     });
 }
 protected internal override void AddClaim(UserClaim item)
 {
     ClaimCollection.Add(new RelationalUserClaim {
         UserAccountID = this.ID, Type = item.Type, Value = item.Value
     });
 }
 protected internal override void RemoveClaim(UserClaim item)
 {
     ClaimCollection.Remove((RelationalUserClaimInt)item);
 }
コード例 #16
0
 public void AddClaim(UserClaim item)
 {
     ClaimCollection.Add(new UserClaim {
         Type = item.Type, Value = item.Value, UserId = this.ID
     });
 }
コード例 #17
0
 protected internal override void RemoveClaim(UserClaim item)
 {
     ClaimCollection.Remove((TUserClaim)item);
 }
コード例 #18
0
        public static string LookForClaim(ClaimCollection claimCollection, string claimType)
        {
            var possibleClaim = claimCollection.FirstOrDefault(c => c.ClaimType == claimType);

            return(possibleClaim == default(Claim) ? null : possibleClaim.Value);
        }
コード例 #19
0
 protected internal override void AddClaim(UserClaim item)
 {
     ClaimCollection.Add(new TUserClaim {
         ParentKey = this.Key, Type = item.Type, Value = item.Value
     });
 }
コード例 #20
0
ファイル: UserAccount.cs プロジェクト: vcardins/gasprice
 public void RemoveClaim(UserClaim item)
 {
     ClaimCollection.Remove(item);
 }
コード例 #21
0
ファイル: MenuModel.cs プロジェクト: hgdelima/Framework.Net40
 public MenuModel(ClaimCollection claims, string appPath)
 {
     _claims  = claims;
     _appPath = appPath;
 }
コード例 #22
0
 public static string LookForClaim(ClaimCollection claimCollection, string claimType)
 {
     var possibleClaim = claimCollection.FirstOrDefault(c => c.ClaimType == claimType);
     return possibleClaim == default(Claim) ? null : possibleClaim.Value;
 }