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)); }
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"); }
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", "~"); }
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"); }
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)); }
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)); }
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") ); } }