Exemplo n.º 1
0
        public void Configure(IAppHost appHost)
        {
            var appSettings = new ServiceStack.Configuration.AppSettings();

            if (appHost.Plugins.Exists(p => p is AuthFeature))
            {
                appHost.Plugins.Remove(appHost.Plugins.First(p => p is AuthFeature));
            }

            string samlLogin = appSettings.GetString("saml.login");

            if (samlLogin == null)
            {
                samlLogin = "******";
            }

            SAMLController.SSOSessionStore = new InMemorySSOSessionStore()
            {
                SessionIDDelegate = delegate()
                {
                    IHttpRequest request = HttpContext.Current.ToRequest();
                    return(request.GetSessionId());
                }
            };

            HostContext.Config.WebHostUrl = appSettings.GetString("saml.WebHostUrl");

            appHost.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {
                new SamlAuthProvider(appSettings),
            }, samlLogin));
        }
Exemplo n.º 2
0
        static WeiXinMpConfig()
        {
            var appSettings = new ServiceStack.Configuration.AppSettings();

            AppId          = appSettings.Get <string>($"WeiXin.MP.AppId");
            AppSecret      = appSettings.Get <string>($"WeiXin.MP.{AppId}.AppSecret");
            Token          = appSettings.Get <string>($"WeiXin.MP.{AppId}.Token");
            EncodingAesKey = appSettings.Get <string>($"WeiXin.MP.{AppId}.EncodingAESKey");
        }
Exemplo n.º 3
0
        static ServerConfig()
        {
            var appSettings = new ServiceStack.Configuration.AppSettings();

            //use default value if no config exists
            AppId = appSettings.Get <string>("AppID");
            WebHostHttpUrlList  = appSettings.GetList("WebAPI.WebHostUrl.Http");
            WebHostHttpsUrlList = appSettings.GetList("WebAPI.WebHostUrl.https");
            BaseUrl             = appSettings.Get <string>("WebAPI.BaseUrl", "");

            UserName = appSettings.Get <string>("WebAPI.UserName");
            Password = appSettings.Get <string>("WebAPI.Password");

            ProjectPath = appSettings.Get <string>("HostingEnvironment.ContentRootPath", "~");
        }
Exemplo n.º 4
0
        static WeiXinWorkConfig()
        {
            var appSettings = new ServiceStack.Configuration.AppSettings();

            //use default value if no config exists
            CorpId = appSettings.Get <string>("WeiXin.Work.CorpId");
            //CorpSecret = appSettings.Get<string>($"WeiXin.Work.{CorpId}.CorpSecret");
            Token          = appSettings.Get <string>($"WeiXin.Work.{CorpId}.Token");
            EncodingAesKey = appSettings.Get <string>($"WeiXin.Work.{CorpId}.EncodingAESKey");

            ProviderSecret    = appSettings.Get <string>($"WeiXin.Work.{CorpId}.ProviderSecret");
            AppSecret         = appSettings.Get <string>($"WeiXin.Work.{CorpId}.AppSecret", "");
            ContactsApiSecret = appSettings.Get <string>($"WeiXin.Work.{CorpId}.ContactsApiSecret");
            SysLogAgentId     = appSettings.Get <string>($"WeiXin.Work.{CorpId}.SysLogAgentId");
            UserLogAgentId    = appSettings.Get <string>($"WeiXin.Work.{CorpId}.UserLogAgentId");
        }
Exemplo n.º 5
0
        public void Configure(IAppHost appHost)
        {
            var appSettings = new ServiceStack.Configuration.AppSettings();

            if (appHost.Plugins.Exists(p => p is AuthFeature))
            {
                appHost.Plugins.Remove(appHost.Plugins.First(p => p is AuthFeature));
            }

            string oauthLogin = appSettings.GetString("oauth.login");

            if (oauthLogin == null)
            {
                oauthLogin = "******";
            }

            appHost.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {
                new GoogleOAuth2ProviderMe(appSettings),
            }, oauthLogin));
        }
Exemplo n.º 6
0
        public void Configure(IAppHost appHost)
        {
            if (appHost.Plugins.Exists(p => p is AuthFeature))
            {
                appHost.Plugins.Remove(appHost.Plugins.First(p => p is AuthFeature));
            }

            var appSettings = new ServiceStack.Configuration.AppSettings();

            if (!AppHostConfig.Instance.IsInWebClient)
            {
                appHost.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {
                    new TokenAuthProvider(),
                    new AadAuthProvider(appSettings)
                }, "~/auth/aad"));

                appHost.Plugins.Add(new CorsFeature(allowedHeaders: "Content-Type,Authorization,Accept", allowedOrigins: "https://localhost:3000", allowCredentials: true));
            }
            else
            {
                appHost.Config.DefaultRedirectPath = "~/ContentManager";



                string oauthLogin = appSettings.GetString("oauth.login");

                if (oauthLogin == null)
                {
                    oauthLogin = "******";
                }


                appHost.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {
                    new AadAuthProvider(appSettings)
                }, "~/auth/aad")


                                    );
            }
        }
        public void Configure(IAppHost appHost)
        {
            var appSettings = new ServiceStack.Configuration.AppSettings();

            if (appHost.Plugins.Exists(p => p is AuthFeature))
            {
                appHost.Plugins.Remove(appHost.Plugins.First(p => p is AuthFeature));
            }

            string samlLogin = appSettings.GetString("saml.login");

            if (samlLogin == null)
            {
                samlLogin = "******";
            }


            // HostContext.Config.WebHostUrl = appSettings.GetString("saml.WebHostUrl");

            appHost.Plugins.Add(new AuthFeature(() => new SamlUserSession(), new IAuthProvider[] {
                new jitbitSamlAuthProvider(appSettings),
            }, samlLogin));
        }
Exemplo n.º 8
0
        public void Configure(IAppHost appHost)
        {
            if (appHost.Plugins.Exists(p => p is AuthFeature))
            {
                appHost.Plugins.Remove(appHost.Plugins.First(p => p is AuthFeature));
            }

            var appSettings = new ServiceStack.Configuration.AppSettings();

            if (!AppHostConfig.Instance.IsInWebClient)
            {
                appHost.PreRequestFilters.Add((httpReq, httpResp) =>
                {
                    var authSession = httpReq.GetSession(false);
                    if (httpReq.Verb == HttpMethods.Post)
                    {
                        if (!authSession.IsAuthenticated)
                        {
                            var meta = (authSession as IMeta).Meta;

                            if (meta != null)
                            {
                                if (httpReq.FormData["items"] != null)
                                {
                                    meta["items"] = httpReq.FormData["items"];
                                    ServiceExtensions.SaveSession(httpReq, authSession);
                                }
                            }
                        }
                    }
                });

                appHost.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] { new MyOpenIdOAuthProvider(appSettings, "OpenId", "aad") }, "~/auth/openid"));

                //appHost.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {
                //	new TokenAuthProvider(),
                //	new AadAuthProvider(appSettings)

                //}, "~/auth/aad"));

                appHost.Plugins.Add(new CorsFeature(allowedHeaders: "Content-Type,Authorization,Accept", allowedOrigins: "https://desktop-39dgcn3:3000", allowCredentials: true));
            }
            else
            {
                appHost.Config.DefaultRedirectPath = "~/ContentManager";



                string oauthLogin = appSettings.GetString("oauth.login");

                if (oauthLogin == null)
                {
                    oauthLogin = "******";
                }


                appHost.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {
                    new AadAuthProvider(appSettings)
                }, "~/auth/aad")


                                    );
            }
        }