コード例 #1
0
        public override void ResolveNames(Scope scope)
        {
            var printToken       = new Token(TokenType.Print, "printInt", 0);
            var readToken        = new Token(TokenType.Read, "readInt", 0);
            var printStringToken = new Token(TokenType.PrintString, "printString", 0);
            var printFloatToken  = new Token(TokenType.PrintFloat, "printFloat", 0);
            var printType        = new TypePrim(printToken);
            var readType         = new TypePrim(readToken);
            var printStringType  = new TypePrim(printStringToken);
            var printFloatType   = new TypePrim(printFloatToken);

            scope.Add(printToken, new DeclFn(printType, printToken, new List <Param> {
                new Param(printToken, new TypePrim(new Token(TokenType.Int, null, 0)))
            }, null));
            scope.Add(printStringToken, new DeclFn(printStringType, printStringToken, new List <Param> {
                new Param(printStringToken, new TypePrim(new Token(TokenType.String, null, 0)))
            }, null));
            scope.Add(printFloatToken, new DeclFn(printFloatType, printFloatToken, new List <Param> {
                new Param(printFloatToken, new TypePrim(new Token(TokenType.Float, null, 0)))
            }, null));
            scope.Add(readToken, new DeclFn(readType, readToken, new List <Param>(), null));

            decls.ForEach(decl => scope.Add(decl.ReturnName(), decl));
            decls.ForEach(decl => decl.ResolveNames(scope));
        }
コード例 #2
0
        public BaseSessionManager(string sessionId, SimplTypesScope translationScope, Scope <object> applicationObjectScope, ServerProcessor frontend)
        {
            FrontEnd         = frontend;
            SessionId        = sessionId;
            TranslationScope = translationScope;

            LocalScope = GenerateContextScope(applicationObjectScope);
            LocalScope.Add(SessionObjects.SessionId, sessionId);
            LocalScope.Add(SessionObjects.ClientManager, this);
        }
コード例 #3
0
        public BaseSessionManager(string sessionId, SimplTypesScope translationScope, Scope<object> applicationObjectScope, ServerProcessor frontend)
        {
            FrontEnd = frontend;
            SessionId = sessionId;
            TranslationScope = translationScope;

            LocalScope = GenerateContextScope(applicationObjectScope);
            LocalScope.Add(SessionObjects.SessionId, sessionId);
            LocalScope.Add(SessionObjects.ClientManager, this);
        }
コード例 #4
0
        public StravaAuthenticationOptions()
        {
            ClaimsIssuer = StravaAuthenticationDefaults.Issuer;

            CallbackPath = StravaAuthenticationDefaults.CallbackPath;

            AuthorizationEndpoint   = StravaAuthenticationDefaults.AuthorizationEndpoint;
            TokenEndpoint           = StravaAuthenticationDefaults.TokenEndpoint;
            UserInformationEndpoint = StravaAuthenticationDefaults.UserInformationEndpoint;

            Scope.Add("read");
            Scope.Add("read_all");
            Scope.Add("profile:read_all");
            Scope.Add("profile:write");
            Scope.Add("activity:read");
            Scope.Add("activity:read_all");
            Scope.Add("activity:write");

            ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id");
            ClaimActions.MapJsonKey(ClaimTypes.Name, "username");
            ClaimActions.MapJsonKey(ClaimTypes.GivenName, "firstname");
            ClaimActions.MapJsonKey(ClaimTypes.Surname, "lastname");
            ClaimActions.MapJsonKey(ClaimTypes.Email, "email");
            ClaimActions.MapJsonKey(ClaimTypes.StateOrProvince, "state");
            ClaimActions.MapJsonKey(ClaimTypes.Country, "country");
            ClaimActions.MapJsonKey(ClaimTypes.Gender, "sex");
            ClaimActions.MapJsonKey(StravaAuthenticationConstants.Claims.City, "city");
            ClaimActions.MapJsonKey(StravaAuthenticationConstants.Claims.Profile, "profile");
            ClaimActions.MapJsonKey(StravaAuthenticationConstants.Claims.ProfileMedium, "profile_medium");
            ClaimActions.MapJsonKey(StravaAuthenticationConstants.Claims.CreatedAt, "created_at");
            ClaimActions.MapJsonKey(StravaAuthenticationConstants.Claims.UpdatedAt, "updated_at");
            ClaimActions.MapJsonKey(StravaAuthenticationConstants.Claims.Premium, "premium");
        }
コード例 #5
0
ファイル: View.xaml.cs プロジェクト: beyaz/ApiInspector
        /// <summary>
        ///     Initializes a new instance of the <see cref="View" /> class.
        /// </summary>
        public View()
        {
            InitializeGlobalFontStyle();

            InitializeComponent();



            var traceMonitor = new TraceMonitor(traceViewer, Dispatcher, traceQueue);

            traceMonitor.StartToMonitor();

            Loaded += (s, e) =>
            {
                scope.Add(ShowErrorNotificationKey, AppScope.Get(ShowErrorNotificationKey));

                UserVisibleTrace      = traceQueue.AddMessage;
                ClearUserVisibleTrace = traceMonitor.CleanAllMessages;

                scope.Update(Keys.Trace, traceQueue.AddMessage);

                historyPanel.Connect(scope);
                currentInvocationInfo.Connect(scope);

                historyPanel.Refresh();

                scenarioEditor.Connect(scope);

                Title = "ApiInspector - " + AuthenticationUserName;
            };

            ShutdownApplicationWhenClosed(this);
        }
コード例 #6
0
 public override void ResolveNames(Scope scope)
 {
     StackSlot = Scope.StackSlotIndex;
     Scope.StackSlotIndex++;
     value?.ResolveNames(scope);
     scope.Add(ident, this);
 }
コード例 #7
0
        public WeixinAuthenticationOptions()
        {
            ClaimsIssuer = WeixinAuthenticationDefaults.Issuer;
            CallbackPath = new PathString(WeixinAuthenticationDefaults.CallbackPath);

            AuthorizationEndpoint   = WeixinAuthenticationDefaults.AuthorizationEndpoint;
            TokenEndpoint           = WeixinAuthenticationDefaults.TokenEndpoint;
            UserInformationEndpoint = WeixinAuthenticationDefaults.UserInformationEndpoint;

            Scope.Add("snsapi_login");
            Scope.Add("snsapi_userinfo");

            ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "unionid");
            ClaimActions.MapJsonKey(ClaimTypes.Name, "nickname");
            ClaimActions.MapJsonKey(ClaimTypes.Gender, "sex");
            ClaimActions.MapJsonKey(ClaimTypes.Country, "country");
            ClaimActions.MapJsonKey(WeixinAuthenticationConstants.Claims.OpenId, "openid");
            ClaimActions.MapJsonKey(WeixinAuthenticationConstants.Claims.Province, "province");
            ClaimActions.MapJsonKey(WeixinAuthenticationConstants.Claims.City, "city");
            ClaimActions.MapJsonKey(WeixinAuthenticationConstants.Claims.HeadImgUrl, "headimgurl");
            ClaimActions.MapCustomJson(WeixinAuthenticationConstants.Claims.Privilege, user =>
            {
                var value = user.Value <JArray>("privilege");
                if (value == null)
                {
                    return(null);
                }

                return(string.Join(",", value.ToObject <string[]>()));
            });
        }
コード例 #8
0
 public ChatClient()
 {
     chatTranslation = ChatTranslations.Get();
     clientScope = new Scope<object>();
     clientScope.Add(ChatConstants.ChatUpdateLisener, this);
     _client = new WebSocketOODSSClient(ServerAddress, PortNumber, chatTranslation, clientScope);
 }
コード例 #9
0
        public WeiChatAuthenticationOptions()
        {
            ClaimsIssuer = WeiChatAuthenticationDefaults.Issuer;
            CallbackPath = new PathString(WeiChatAuthenticationDefaults.CallbackPath);

            AuthorizationEndpoint   = WeiChatAuthenticationDefaults.AuthorizationEndpoint;
            TokenEndpoint           = WeiChatAuthenticationDefaults.TokenEndpoint;
            UserInformationEndpoint = WeiChatAuthenticationDefaults.UserInformationEndpoint;

            Scope.Add("snsapi_login");
            Scope.Add("snsapi_userinfo");

            ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "unionid");
            ClaimActions.MapJsonKey(ClaimTypes.Name, "nickname");
            ClaimActions.MapJsonKey(ClaimTypes.Gender, "sex", ClaimValueTypes.Integer);

            ClaimActions.MapJsonKey(Claims.OpenId, "openid");
            ClaimActions.MapJsonKey(Claims.NickName, "nickname");
            ClaimActions.MapJsonKey(Claims.Language, "language");
            ClaimActions.MapJsonKey(Claims.City, "city");
            ClaimActions.MapJsonKey(Claims.Province, "province");
            ClaimActions.MapJsonKey(ClaimTypes.Country, "country");
            ClaimActions.MapJsonKey(Claims.HeadImgUrl, "headimgurl");
            ClaimActions.MapCustomJson(Claims.Privilege, user =>
            {
                var value = user.Value <JArray>("privilege");
                return(value == null ? null : string.Join(",", value.ToObject <string[]>()));
            });
            //ClaimActions.MapCustomJson(Claims.Privilege, user => string.Join(",", user.SelectToken("privilege")?.Select(s => (string)s).ToArray() ?? new string[0]));
        }
コード例 #10
0
        public CultureParser AddCulture(String name)
        {
            if (name != "norse")
            {
                String oname = name;
                name = StarNames.SafeName(name);

                LanguageManager.instance.Add(name, oname);
            }


            ScriptScope scope = new ScriptScope();

            scope.Name = name;
            Name       = name;

            Scope.Add(scope);
            CultureParser r = new CultureParser(scope);

            CultureManager.instance.AllCultures.Add(r);
            Cultures.Add(r);
            CultureManager.instance.CultureMap[name] = r;
            r.Name = Name;
            r.Init();

            Scope.SetChild(r.Scope);
            return(r);
        }
コード例 #11
0
        /// <summary>
        /// Initializes a new <see cref="FacebookOptions"/>.
        /// </summary>
        public FacebookOptions()
        {
            CallbackPath            = new PathString("/signin-facebook");
            SendAppSecretProof      = true;
            AuthorizationEndpoint   = FacebookDefaults.AuthorizationEndpoint;
            TokenEndpoint           = FacebookDefaults.TokenEndpoint;
            UserInformationEndpoint = FacebookDefaults.UserInformationEndpoint;
            Scope.Add("public_profile");
            Scope.Add("email");
            Fields.Add("name");
            Fields.Add("email");
            Fields.Add("first_name");
            Fields.Add("last_name");

            ClaimActions.MapJsonKey("sub", "id");
            ClaimActions.MapJsonSubKey("urn:facebook:age_range_min", "age_range", "min");
            ClaimActions.MapJsonSubKey("urn:facebook:age_range_max", "age_range", "max");
            ClaimActions.MapJsonKey("birthdate", "birthday");
            ClaimActions.MapJsonKey("email", "email");
            ClaimActions.MapJsonKey("name", "name");
            ClaimActions.MapJsonKey("given_name", "first_name");
            ClaimActions.MapJsonKey("middle_name", "middle_name");
            ClaimActions.MapJsonKey("family_name", "last_name");
            ClaimActions.MapJsonKey("gender", "gender");
            ClaimActions.MapJsonKey("urn:facebook:link", "link");
            ClaimActions.MapJsonSubKey("urn:facebook:location", "location", "name");
            ClaimActions.MapJsonKey("locale", "locale");
            ClaimActions.MapJsonKey("urn:facebook:timezone", "timezone");
        }
コード例 #12
0
ファイル: NativeCallContext.cs プロジェクト: xeno-by/elf4b
        public NativeCallContext(NativeMethod source, IElfObject @this, params IElfObject[] args) 
        {
            Stack = new Stack<IElfObject>();

            var callScope = new Scope();
            callScope.Add("@this", @this);
            source.FuncDef.Args.Zip(args, callScope.Add);
            Scopes = new Stack<Scope>();
            Scopes.Push(callScope);

            Source = source;
            if (source.FuncDef.Args.Count() != args.Length)
            {
                throw new UnexpectedElfRuntimeException(@this.VM, String.Format(
                   "Fatal error invoking native call '{0}({1})' with args '{2}'. Reason: args count mismatch.",
                   Source.Name, Source.FuncDef.Args.StringJoin(), args.StringJoin()));
            }

            CurrentEvi = 0;
            PrevEvi = -1;
            if (source.Body.IsNullOrEmpty())
            {
                throw new UnexpectedElfRuntimeException(@this.VM, String.Format(
                   "Fatal error invoking native call '{0}'. Reason: empty method body.", Source.Name));
            } 
        }
コード例 #13
0
ファイル: BtOAuthOptions.cs プロジェクト: lghinet/psd2
        public BtOAuthOptions()
        {
            AuthorizationEndpoint = "https://apistorebt.ro/mga/sps/oauth/oauth20/authorize";
            TokenEndpoint = "https://api.apistorebt.ro/bt/sb/oauth/token";
            CallbackPath = "/signin-bt";
            SaveTokens = true;

            Scope.Add("openid");
            Scope.Add("profile");
            Scope.Add("email");

            ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id");
            ClaimActions.MapJsonKey(ClaimTypes.Name, "name");
            ClaimActions.MapJsonKey(ClaimTypes.GivenName, "given_name");
            ClaimActions.MapJsonKey(ClaimTypes.Surname, "family_name");
            ClaimActions.MapJsonKey(ClaimTypes.Email, "email");

            Events.OnTicketReceived = context =>
            {
                context.HandleResponse();

                // Default redirect path is the base path
                if (string.IsNullOrEmpty(context.ReturnUri))
                {
                    context.ReturnUri = "/";
                }

                context.Response.Redirect(context.ReturnUri);
                return Task.CompletedTask;
            };
        }
コード例 #14
0
        public EsiaAuthenticationOptions()
        {
            CallbackPath            = new PathString("/signin-esia");
            AuthorizationEndpoint   = EsiaAuthenticationDefaults.AuthorizationEndpoint;
            TokenEndpoint           = EsiaAuthenticationDefaults.TokenEndpoint;
            UserInformationEndpoint = EsiaAuthenticationDefaults.UserInformationEndpoint;

            Scope.Add(EsiaConstants.UserInformationScope);

            ClaimActions.MapJsonKey(ClaimTypes.DateOfBirth, "birthDate");
            ClaimActions.MapJsonKey(ClaimTypes.Gender, "gender");
            ClaimActions.MapJsonKey(ClaimTypes.GivenName, "firstName");
            ClaimActions.MapJsonKey(ClaimTypes.Surname, "lastName");
            ClaimActions.MapJsonKey(EsiaConstants.TrustedUrn, "trusted");
            ClaimActions.MapJsonKey(EsiaConstants.MiddleNameUrn, "middleName");
            ClaimActions.MapJsonKey(EsiaConstants.BirthPlaceUrn, "birthPlace");
            ClaimActions.MapJsonKey(EsiaConstants.CitizenshipUrn, "citizenship");
            ClaimActions.MapJsonKey(EsiaConstants.SnilsUrn, "snils");
            ClaimActions.MapJsonKey(EsiaConstants.InnUrn, "inn");
            ClaimActions.MapCustomJson(ClaimTypes.Name, ParseName);
            ClaimActions.MapCustomJson(ClaimTypes.Email, obj => ParseContactInfo(obj, "EML"));
            ClaimActions.MapCustomJson(ClaimTypes.MobilePhone, obj => ParseContactInfo(obj, "MBT"));
            ClaimActions.MapCustomJson(ClaimTypes.HomePhone, obj => ParseContactInfo(obj, "PHN"));
            ClaimActions.MapCustomJson(ClaimTypes.OtherPhone, obj => ParseContactInfo(obj, "CPH"));
        }
コード例 #15
0
    public KloudlessAuthenticationOptions()
    {
        ClaimsIssuer = KloudlessAuthenticationDefaults.Issuer;
        CallbackPath = KloudlessAuthenticationDefaults.CallbackPath;

        AuthorizationEndpoint   = KloudlessAuthenticationDefaults.AuthorizationEndpoint;
        TokenEndpoint           = KloudlessAuthenticationDefaults.TokenEndpoint;
        UserInformationEndpoint = KloudlessAuthenticationDefaults.UserInformationEndpoint;

        ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id");
        ClaimActions.MapJsonKey(ClaimTypes.Name, "account");
        ClaimActions.MapJsonKey(Claims.Account, "account");
        ClaimActions.MapJsonKey(Claims.Service, "service");
        ClaimActions.MapJsonKey(Claims.InternalUse, "internal_use");
        ClaimActions.MapJsonKey(Claims.Created, "created");
        ClaimActions.MapJsonKey(Claims.Modified, "modified");
        ClaimActions.MapJsonKey(Claims.ServiceName, "service_name");
        ClaimActions.MapJsonKey(Claims.Admin, "admin");
        ClaimActions.MapJsonKey(Claims.Apis, "apis");
        ClaimActions.MapJsonKey(Claims.EffectiveScope, "effective_scope");
        ClaimActions.MapJsonKey(Claims.Api, "api");
        ClaimActions.MapJsonKey(Claims.Type, "type");
        ClaimActions.MapJsonKey(Claims.Enabled, "enabled");
        ClaimActions.MapJsonKey(Claims.ObjectDefinitions, "object_definitions");
        ClaimActions.MapJsonKey(Claims.CustomProperties, "custom_properties");
        ClaimActions.MapJsonKey(Claims.ProxyConnection, "proxy_connection");
        ClaimActions.MapJsonKey(Claims.Active, "active");

        Scope.Add(Scopes.Any);
    }
コード例 #16
0
        internal CodeThrowExceptionStatement Throw()
        {
            var t = new CodeThrowExceptionStatement();

            Scope.Add(t);
            return(t);
        }
コード例 #17
0
        internal CodeThrowExceptionStatement Throw(CodeExpression codeExpression)
        {
            var t = new CodeThrowExceptionStatement(codeExpression);

            Scope.Add(t);
            return(t);
        }
コード例 #18
0
        public AlipayAuthenticationOptions()
        {
            ClaimsIssuer = AlipayAuthenticationDefaults.Issuer;
            CallbackPath = new PathString(AlipayAuthenticationDefaults.CallbackPath);

            AuthorizationEndpoint   = AlipayAuthenticationDefaults.AuthorizationEndpoint;
            TokenEndpoint           = AlipayAuthenticationDefaults.TokenEndpoint;
            UserInformationEndpoint = AlipayAuthenticationDefaults.UserInformationEndpoint;

            GatewayUrl      = AlipayAuthenticationDefaults.GatewayUrl;
            AlipayPublicKey = AlipayAuthenticationDefaults.AlipayPublicKey;
            SignType        = AlipayAuthenticationDefaults.SignType;
            CharSet         = AlipayAuthenticationDefaults.CharSet;
            Version         = AlipayAuthenticationDefaults.Version;
            Format          = AlipayAuthenticationDefaults.Format;
            IsKeyFromFile   = AlipayAuthenticationDefaults.IsKeyFromFile;

            Scope.Add("auth_user");

            ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "user_id");
            ClaimActions.MapJsonKey(ClaimTypes.Name, "nick_name");
            //【注意】只有is_certified为T的时候才有意义,否则不保证准确性. 性别(F:女性;M:男性)。
            ClaimActions.MapJsonKey(ClaimTypes.Gender, "gender", ClaimValueTypes.Integer);

            ClaimActions.MapJsonKey(Claims.UserId, "user_id");
            ClaimActions.MapJsonKey(Claims.NickName, "nick_name");
            ClaimActions.MapJsonKey(Claims.Avatar, "avatar");
            ClaimActions.MapJsonKey(Claims.Province, "province");
            ClaimActions.MapJsonKey(Claims.City, "city");
            ClaimActions.MapJsonKey(Claims.IsStudentCertified, "is_student_certified");
            ClaimActions.MapJsonKey(Claims.UserType, "user_type");
            ClaimActions.MapJsonKey(Claims.UserStatus, "user_status");
            ClaimActions.MapJsonKey(Claims.IsCertified, "is_certified");
        }
コード例 #19
0
        public CodeStatement SideEffect(CodeExpression exp)
        {
            var sideeffect = new CodeExpressionStatement(exp);

            Scope.Add(sideeffect);
            return(sideeffect);
        }
コード例 #20
0
        internal CodeCommentStatement Comment(string comment)
        {
            var c = new CodeCommentStatement(comment);

            Scope.Add(c);
            return(c);
        }
コード例 #21
0
        /// <summary>
        /// Initializes a new <see cref="GoogleOptions"/>.
        /// </summary>
        public GoogleOpenIdConnectOptions()
        {
            CallbackPath = new PathString("/signin-google");
            Authority    = "https://accounts.google.com";

            ResponseType = OpenIdConnectResponseType.Code;
            GetClaimsFromUserInfoEndpoint = true;
            SaveTokens = true;

            Events = new OpenIdConnectEvents()
            {
                OnRedirectToIdentityProvider = (context) =>
                {
                    if (context.Request.Path != "/Account/ExternalLogin")
                    {
                        context.Response.Redirect("/account/login");
                        context.HandleResponse();
                    }

                    return(Task.FromResult(0));
                }
            };
            Scope.Add("openid");
            Scope.Add("profile");
            Scope.Add("email");

            ClaimActionCollectionMapExtensions.MapJsonKey(ClaimActions, ClaimTypes.NameIdentifier, "id");
            ClaimActionCollectionMapExtensions.MapJsonKey(ClaimActions, ClaimTypes.Name, "displayName");
            ClaimActionCollectionMapExtensions.MapJsonSubKey(ClaimActions, ClaimTypes.GivenName, "name", "givenName");
            ClaimActionCollectionMapExtensions.MapJsonSubKey(ClaimActions, ClaimTypes.Surname, "name", "familyName");
            ClaimActionCollectionMapExtensions.MapJsonKey(ClaimActions, "urn:google:profile", "url");
            ClaimActionCollectionMapExtensions.MapCustomJson(ClaimActions, ClaimTypes.Email, GoogleHelper.GetEmail);
        }
        public WeixinAuthenticationOptions()
        {
            ClaimsIssuer = WeixinAuthenticationDefaults.Issuer;
            CallbackPath = WeixinAuthenticationDefaults.CallbackPath;

            AuthorizationEndpoint   = WeixinAuthenticationDefaults.AuthorizationEndpoint;
            TokenEndpoint           = WeixinAuthenticationDefaults.TokenEndpoint;
            UserInformationEndpoint = WeixinAuthenticationDefaults.UserInformationEndpoint;

            Scope.Add("snsapi_login");
            Scope.Add("snsapi_userinfo");

            ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "unionid");
            ClaimActions.MapJsonKey(ClaimTypes.Name, "nickname");
            ClaimActions.MapJsonKey(ClaimTypes.Gender, "sex");
            ClaimActions.MapJsonKey(ClaimTypes.Country, "country");
            ClaimActions.MapJsonKey(Claims.OpenId, "openid");
            ClaimActions.MapJsonKey(Claims.Province, "province");
            ClaimActions.MapJsonKey(Claims.City, "city");
            ClaimActions.MapJsonKey(Claims.HeadImgUrl, "headimgurl");
            ClaimActions.MapCustomJson(Claims.Privilege, user =>
            {
                if (!user.TryGetProperty("privilege", out var value) || value.ValueKind != System.Text.Json.JsonValueKind.Array)
                {
                    return(null);
                }

                return(string.Join(',', value.EnumerateArray().Select(element => element.GetString())));
            });
        }
コード例 #23
0
        /// <summary>
        /// Initializes a new <see cref="NortonOpenIdConnectOptions"/>.
        /// </summary>
        public NortonOpenIdConnectOptions()
        {
            CallbackPath = new PathString("/signin-norton");
            Authority    = NortonDefaults.Development.Authority;

            ResponseType = OpenIdConnectResponseType.Code;
            GetClaimsFromUserInfoEndpoint = true;
            SaveTokens = true;

            Events = new OpenIdConnectEvents()
            {
                OnRedirectToIdentityProvider = (context) =>
                {
                    if (context.Request.Path != "/Account/ExternalLogin")
                    {
                        context.Response.Redirect("/account/login");
                        context.HandleResponse();
                    }

                    return(Task.FromResult(0));
                }
            };
            Scope.Add("openid");
            Scope.Add("profile");
            Scope.Add("email");

            ClaimActionCollectionMapExtensions.MapJsonKey(ClaimActions, ClaimTypes.NameIdentifier, "id");
            ClaimActionCollectionMapExtensions.MapJsonKey(ClaimActions, ClaimTypes.Name, "displayName");
            ClaimActionCollectionMapExtensions.MapJsonSubKey(ClaimActions, ClaimTypes.GivenName, "name", "givenName");
            ClaimActionCollectionMapExtensions.MapJsonSubKey(ClaimActions, ClaimTypes.Surname, "name", "familyName");
        }
コード例 #24
0
        public override void Execute(Scope scope)
        {
            // adds static class to scope
            Class c = new Class(Name, ArgNames);

            scope.Add(Name, c);
        }
コード例 #25
0
        /// <summary>
        /// Configuration options for <see cref="StravaHandler"/>.
        /// </summary>
        public StravaOptions()
        {
            ClaimsIssuer = StravaDefaults.Issuer;

            CallbackPath = new PathString(StravaDefaults.CallbackPath);

            AuthorizationEndpoint   = StravaDefaults.AuthorizationEndpoint;
            TokenEndpoint           = StravaDefaults.TokenEndpoint;
            UserInformationEndpoint = StravaDefaults.UserInformationEndpoint;

            Scope.Add("public");

            ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id");
            ClaimActions.MapJsonKey(ClaimTypes.Name, "username");
            ClaimActions.MapJsonKey(ClaimTypes.GivenName, "firstname");
            ClaimActions.MapJsonKey(ClaimTypes.Surname, "lastname");
            ClaimActions.MapJsonKey(ClaimTypes.Email, "email");
            ClaimActions.MapJsonKey(ClaimTypes.StateOrProvince, "state");
            ClaimActions.MapJsonKey(ClaimTypes.Country, "country");
            ClaimActions.MapJsonKey(ClaimTypes.Gender, "sex");
            ClaimActions.MapJsonKey("urn:strava:city", "city");
            ClaimActions.MapJsonKey("urn:strava:profile", "profile");
            ClaimActions.MapJsonKey("urn:strava:profile-medium", "profile_medium");
            ClaimActions.MapJsonKey("urn:strava:created-at", "created_at");
            ClaimActions.MapJsonKey("urn:strava:updated-at", "updated_at");
            ClaimActions.MapJsonKey("urn:strava:premium", "premium");
        }
コード例 #26
0
        /// <summary>
        /// Initializes a new <see cref="GoogleOptions"/>.
        /// </summary>
        public NortonOpenIdConnectOptions()
        {
            CallbackPath = new PathString("/signin-norton-two");
            Authority    = NortonDefaults.Development.Authority;

            ResponseType = OpenIdConnectResponseType.Code;
            GetClaimsFromUserInfoEndpoint = true;
            SaveTokens = true;

            Events = new OpenIdConnectEvents()
            {
                OnRedirectToIdentityProvider = (context) =>
                {
                    if (context.Request.Path != "/Account/ExternalLogin")
                    {
                        context.Response.Redirect("/Account/login");
                        context.HandleResponse();
                    }

                    return(Task.FromResult(0));
                }
            };
            Scope.Add("openid");
            Scope.Add("profile");
            Scope.Add("email");
        }
        public PaypalAuthenticationOptions()
        {
            ClaimsIssuer = PaypalAuthenticationDefaults.Issuer;
            CallbackPath = PaypalAuthenticationDefaults.CallbackPath;

            AuthorizationEndpoint   = PaypalAuthenticationDefaults.AuthorizationEndpoint;
            TokenEndpoint           = PaypalAuthenticationDefaults.TokenEndpoint;
            UserInformationEndpoint = PaypalAuthenticationDefaults.UserInformationEndpoint;

            Scope.Add("openid");
            Scope.Add("profile");
            Scope.Add("email");

            ClaimActions.MapJsonKey(ClaimTypes.Name, "name");
            ClaimActions.MapJsonKey(ClaimTypes.GivenName, "given_name");
            ClaimActions.MapJsonKey(ClaimTypes.Surname, "family_name");
            ClaimActions.MapCustomJson(ClaimTypes.NameIdentifier, user => user.GetString("user_id")?.Split('/')?.LastOrDefault());

            ClaimActions.MapCustomJson(
                ClaimTypes.Email,
                user =>
            {
                if (user.TryGetProperty("emails", out var emails))
                {
                    return(emails.EnumerateArray()
                           .Where((p) => p.GetProperty("primary").GetBoolean())
                           .Select((p) => p.GetString("value"))
                           .FirstOrDefault());
                }

                return(null);
            });
        }
コード例 #28
0
        internal CodeYieldStatement Yield(CodeExpression exp)
        {
            var y = new CodeYieldStatement(exp);

            Scope.Add(y);
            return(y);
        }
コード例 #29
0
        public ReligionParser AddReligion(String name, String orig = null)
        {
            if (name != "pagan")
            {
                String oname = name;
                name = StarNames.SafeName(name);
                LanguageManager.instance.Add(name, oname);
                orig = oname;
            }



            ScriptScope scope = new ScriptScope();

            scope.Name = name;
            Scope.Add(scope);
            ReligionParser r = new ReligionParser(scope);

            ReligionManager.instance.AllReligions.Add(r);
            if (orig != null)
            {
                r.LanguageName = orig;
            }
            Religions.Add(r);
            ReligionManager.instance.ReligionMap[name] = r;
            return(r);
        }
コード例 #30
0
ファイル: WeChatOptions.cs プロジェクト: biankai126/front
        public WeChatOptions()
        {
            CallbackPath            = new PathString("/signin-wechat");
            AuthorizationEndpoint   = WeChatDefaults.AuthorizationEndpoint;
            AuthorizationEndpoint2  = WeChatDefaults.AuthorizationEndpoint2;
            TokenEndpoint           = WeChatDefaults.TokenEndpoint;
            UserInformationEndpoint = WeChatDefaults.UserInformationEndpoint;

            //Scope 表示应用授权作用域。
            //网页上登录(非微信浏览器)需要两个Scope,一个是UserInfo,一个是Login
            Scope.Add(UserInfoScope);
            Scope.Add(LoginScope);

            //微信内嵌浏览器Login只需要UserInfo
            Scope2 = new List <string>();
            Scope2.Add(UserInfoScope);

            //除了openid外,其余的都可能为空,因为微信获取用户信息是有单独权限的
            ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "openid");
            ClaimActions.MapJsonKey(ClaimTypes.Name, "nickname");
            ClaimActions.MapJsonKey(ClaimTypes.Gender, "sex", ClaimValueTypes.Integer);
            ClaimActions.MapJsonKey(ClaimTypes.Country, "country");     //ClaimTypes.Locality
            ClaimActions.MapJsonKey("urn:wechat:province", "province"); //ClaimTypes.StateOrProvince
            ClaimActions.MapJsonKey("urn:wechat:city", "city");         //ClaimTypes.StreetAddress
            ClaimActions.MapJsonKey(ClaimTypes.Uri, "headimgurl");
            ClaimActions.MapCustomJson("urn:wechat:privilege", user => string.Join(",", user.GetProperty("privilege").EnumerateArray().Select(s => s.GetString()).ToArray() ?? new string[0]));
            ClaimActions.MapJsonKey("urn:wechat:unionid", "unionid");

            IsWeChatBrowser = (r) => r.Headers[HeaderNames.UserAgent].ToString().ToLower().Contains("micromessenger");
        }
コード例 #31
0
    /// <summary>
    /// Initializes a new <see cref="FacebookOptions"/>.
    /// </summary>
    public FacebookOptions()
    {
        CallbackPath            = new PathString("/signin-facebook");
        SendAppSecretProof      = true;
        AuthorizationEndpoint   = FacebookDefaults.AuthorizationEndpoint;
        TokenEndpoint           = FacebookDefaults.TokenEndpoint;
        UserInformationEndpoint = FacebookDefaults.UserInformationEndpoint;
        Scope.Add("email");
        Fields.Add("name");
        Fields.Add("email");
        Fields.Add("first_name");
        Fields.Add("last_name");

        ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id");
        ClaimActions.MapJsonSubKey("urn:facebook:age_range_min", "age_range", "min");
        ClaimActions.MapJsonSubKey("urn:facebook:age_range_max", "age_range", "max");
        ClaimActions.MapJsonKey(ClaimTypes.DateOfBirth, "birthday");
        ClaimActions.MapJsonKey(ClaimTypes.Email, "email");
        ClaimActions.MapJsonKey(ClaimTypes.Name, "name");
        ClaimActions.MapJsonKey(ClaimTypes.GivenName, "first_name");
        ClaimActions.MapJsonKey("urn:facebook:middle_name", "middle_name");
        ClaimActions.MapJsonKey(ClaimTypes.Surname, "last_name");
        ClaimActions.MapJsonKey(ClaimTypes.Gender, "gender");
        ClaimActions.MapJsonKey("urn:facebook:link", "link");
        ClaimActions.MapJsonSubKey("urn:facebook:location", "location", "name");
        ClaimActions.MapJsonKey(ClaimTypes.Locality, "locale");
        ClaimActions.MapJsonKey("urn:facebook:timezone", "timezone");
    }
コード例 #32
0
 public override void ResolveNames(Scope scope)
 {
     StackSlot = Method.LocalVariableCount++;
     Type.ResolveNames(scope);
     scope.Add(new Name(Name, NameType.Variable), this);
     Expression?.ResolveNames(scope);
 }
コード例 #33
0
        public CodeAssignStatement Assign(CodeExpression lhs, CodeExpression rhs)
        {
            var ass = new CodeAssignStatement(lhs, rhs);

            Scope.Add(ass);
            return(ass);
        }
コード例 #34
0
        /// <summary>
        /// Initialize a websocket oodss server object
        /// </summary>
        /// <param name="serverTranslationScope">translationscope for the oodss messages</param>
        /// <param name="applicationObjectScope">server object scope</param>
        /// <param name="idleConnectionTimeout"></param>
        /// <param name="maxMessageSize"></param>
        public WebSocketOODSSServer(SimplTypesScope serverTranslationScope, Scope<object> applicationObjectScope,
			int idleConnectionTimeout=-1, int maxMessageSize=-1, int port=0)
            : base(port, Dns.GetHostAddresses(Dns.GetHostName()), serverTranslationScope, applicationObjectScope, 
            idleConnectionTimeout, maxMessageSize)
        {
            MaxMessageSize = maxMessageSize + NetworkConstants.MaxHttpHeaderLength;
            TranslationScope = serverTranslationScope;

            ApplicationObjectScope = applicationObjectScope;

            ApplicationObjectScope.Add(SessionObjects.SessionsMap, ClientSessionManagerMap);
            ApplicationObjectScope.Add(SessionObjects.WebSocketOODSSServer, this);

            _serverInstance = this;

            SetUpWebSocketServer(port);
        }
コード例 #35
0
 public TestServiceClient(string serviceAddress, int port)
 {
     _serviceAddress = serviceAddress;
     _port = port;
     _testTypesScope = TestClientTypesScope.Get();
     _clientScope = new Scope<object>();
     _clientScope.Add(TestServiceConstants.ServiceUpdateListener, this);
     _client = new WebSocketOODSSClient(_serviceAddress, _port, _testTypesScope, _clientScope);
 }
コード例 #36
0
ファイル: NVForeachDirective.cs プロジェクト: jonorossi/cvsi
        public override void DoSemanticChecks(ErrorHandler errs, Scope currentScope)
        {
            _scope = new Scope(currentScope, this);

            // Add foreach loop iterator variable to the scope
            if (!string.IsNullOrEmpty(_iterator))
            {
                _scope.Add(new NVLocalNode(_iterator, null));
            }

            foreach (AstNode astNode in _content)
            {
                astNode.DoSemanticChecks(errs, _scope);
            }
        }
コード例 #37
0
        public override void Wrap(Scope scope)
        {
            base.Wrap(scope);

            // now we need to add default columns if necessary
            if (Columns.Count == 0)
                AddDefaultColumns(scope);

            // next we need to remove child extents of the select from scope
            if (Name != null)
            {
                scope.Remove(this);
                scope.Add(Name, this);
            }
        }
コード例 #38
0
        public static Expression CompileAssign(Assign node, Scope scope)
        {
            var variable = node.Variable as Value;
            var value = node.Value;

            if (variable != null)
            {
                if (variable.IsObject)
                {
                    var obj = variable.Base as Obj;
                    return CompileObjectAssignment(obj, value, scope);
                }

                if (!node.Variable.IsAssignable)
                    throw new InvalidOperationException("Variable is not assignable");
                if (!variable.HasProperties)
                {
                    foreach(var name in CompileToNames(variable))
                        scope.Add(name, VariableType.Variable);
                }
            }

            var right = Compile(value, scope);

            return GetMemberInvocaton(node.Variable, scope,
                        (memberObject, name) => Expression.Dynamic(scope.GetRuntime().SetMemberBinders.Get(name), typeof (object), memberObject, right),
                        (memberObject) => Expression.Assign(memberObject, right));
        }
コード例 #39
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="newMap"></param>
        /// <param name="key"></param>
        /// <param name="translationEntry"></param>
        /// <param name="warn"></param>
        private void UpdateMapWithEntry(Scope<ClassDescriptor> newMap, string key, ClassDescriptor translationEntry, string warn)
        {
            ClassDescriptor existingEntry = null;

            Boolean entryExists = newMap.TryGetValue(key, out existingEntry);
            Boolean newEntry = !entryExists ? true : existingEntry.DescribedClass != translationEntry.DescribedClass;

            if (newEntry)
            {
                if (entryExists)
                    Debug.WriteLine("Overriding " + warn + " " + key + " with " + translationEntry);

                newMap.Add(key, translationEntry);
            }
        }
コード例 #40
0
        // background working thread

        #endregion WebSocketComponent

        #region Constructor

        /// <summary>
        /// Initialze a websocket OODSS client object
        /// </summary>
        /// <param name="ipAddress">server's ip address</param>
        /// <param name="portNumber">server's port number</param>
        /// <param name="translationScope">TranslationScope for OODSS messages</param>
        /// <param name="objectRegistry">application object scope</param>
        public WebSocketOODSSClient(String ipAddress, int portNumber, SimplTypesScope translationScope,
                                    Scope<object> objectRegistry)
        {
            ObjectRegistry = objectRegistry;
            TranslationScope = translationScope;
            ObjectRegistry.Add(SessionObjects.SessionId, _sessionId);
            ServerAddress = ipAddress;
            PortNumber = portNumber;


            _pendingRequests = new ConcurrentDictionary<long, RequestQueueObject>();
            _requestQueue = new BlockingCollection<RequestQueueObject>(new ConcurrentQueue<RequestQueueObject>());
            _responseQueue = new BlockingCollection<ResponseQueueObject>(new ConcurrentQueue<ResponseQueueObject>());


        }
コード例 #41
0
        public void Push(JObject doc)
        {
            Scope currentScope = new Scope();

            JToken t;
            if (doc.TryGetValue("@context", out t))
            {
                JObject context = (JObject)t;
                foreach (JProperty prop in context.Properties())
                {
                    if (prop.Value.Type == JTokenType.Object)
                    {
                        currentScope.Add(prop.Name, new TermDefinition((JObject)prop.Value));
                    }
                    else
                    {
                        string value = prop.Value.ToString();

                        switch (prop.Name)
                        {
                            case "@base":
                                currentScope.Base = value;
                                break;
                            case "@vocab":
                                currentScope.Vocab = value;
                                break;
                            case "@language":
                                currentScope.Language = value;
                                break;
                            default:
                                switch (value)
                                {
                                    case "@id":
                                    case "@type":
                                        //TODO: other keywords
                                        currentScope.AddAlias(prop.Name, value);
                                        break;
                                    default:
                                        currentScope.Add(prop.Name, new TermDefinition(value));
                                        break;
                                }
                                break;
                        }
                    }
                }

                currentScope.Expand(this);
            }

            _context.Push(currentScope);
        }
コード例 #42
0
ファイル: NVClassNode.cs プロジェクト: jonorossi/cvsi
        public void AddIdentsToScope(ErrorHandler errs, Scope currentScope)
        {
            _scope = new Scope(currentScope, this);

            foreach (NVMethodNode methodNode in _methods)
            {
                if (_scope.Exists(methodNode.Name))
                {
                    AddSemanticError(errs, string.Format("Type '{0}' already defines a member called {1}", _name, methodNode.Name),
                        methodNode.Position, ErrorSeverity.Error);
                }
                else
                {
                    _scope.Add(methodNode);
                }
            }
        }