示例#1
0
        public ClaimsIdentity GenerateIdentity(string authToken)
        {
            var toon = new ESI.Models.Character.Detail(authToken);
            var corp = new ESI.Models.Corporation.Detail(toon.CorporationId);

            using (var context = new DatabaseContext())
            {
                if (!context.Corporations.Any(s => s.Id == corp.Id) &&
                    (!corp.AllianceId.HasValue || !context.Alliances.Any(s => s.Id == corp.AllianceId)))
                {
                    return(null);
                }
            }

            var identity = new ClaimsIdentity(DefaultAuthenticationTypes.ApplicationCookie);

            identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, toon.Id.ToString()));
            identity.AddClaim(new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider", "ASP.NET Identity", "http://www.w3.org/2001/XMLSchema#string"));

            identity.AddClaim(new Claim(ClaimTypes.Name, toon.Name));

            return(identity);
        }
示例#2
0
        public IEnumerable <Contract> GetContracts(string accessToken)
        {
            var corp = new ESI.Models.Corporation.Detail(Properties.Settings.Default.LogisticsCorpId);

            return(corp.GetContracts(accessToken));
        }