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
        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.º 3
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.º 5
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")


                                    );
            }
        }