public static SSOSettings CreateSSOSettings() { var settings = new SSOSettings { Apps = new List <SSOTargetSettings> { new SSOTargetSettings { AppName = "App1", AuthenticationUrlTemplate = "Url1-{0}", ExpireInSeconds = 5, TokenProviderSettings = new TokenProviderSettings() }, new SSOTargetSettings { AppName = "App2", AuthenticationUrlTemplate = "Url2-{0}", ExpireInSeconds = 10, TokenProviderSettings = new TokenProviderSettings() } } }; return(settings); }
public void CreatesSSOManager() { // Arrange var targetSettings = new SSOSettings(); targetSettings.Apps.Add(new SSOTargetSettings { AppName = "App1", AuthenticationUrlTemplate = "Url1", ExpireInSeconds = 1, TokenProviderSettings = new TokenProviderSettings() }); targetSettings.Apps.Add(new SSOTargetSettings { AppName = "App2", AuthenticationUrlTemplate = "Url2", ExpireInSeconds = 2, TokenProviderSettings = new TokenProviderSettings() }); var factoryMock = new Mock <ITokenProviderFactory>(); var optionsMock = new Mock <IOptions <SSOSettings> >(); optionsMock.Setup(x => x.Value).Returns(targetSettings); // Act var target = new SSOManager(factoryMock.Object, optionsMock.Object); // Assert factoryMock.Verify(x => x.Create(It.IsAny <TokenProviderSettings>()), Times.Exactly(targetSettings.Apps.Count)); }
public SSOController( UserStore userStore, UserManager userManager, PortunusSSOService ssoService, SSOSettings settings) { this.userStore = userStore; this.userManager = userManager; this.ssoService = ssoService; this.settings = settings; }
public SSOManager(ITokenProviderFactory factory, IOptions <SSOSettings> options) { factory.ThrowIfNull(nameof(factory)); settings = options.ThrowIfNull(nameof(options)).Value; settings.ThrowIfNull(nameof(settings)); ssoServices = new Dictionary <string, SSOService>(); foreach (var app in settings.Apps) { var ssoService = new SSOService(factory, app); ssoServices.Add(app.AppName.ToLower(), ssoService); } }
public void ThrowsIfSSOTargetSettingsAreInvalid( SSOTargetSettings settings, Type exceptionType, string expectedParamName) { // Arrange var targetSettings = new SSOSettings(); targetSettings.Apps.Add(settings); var factoryMock = new Mock <ITokenProviderFactory>(); var optionsMock = new Mock <IOptions <SSOSettings> >(); optionsMock.Setup(x => x.Value).Returns(targetSettings); // Act/Assert var ex = Assert.Throws(exceptionType, () => new SSOManager(factoryMock.Object, optionsMock.Object)); Assert.Equal(expectedParamName, ((ArgumentException)ex).ParamName); }
public PortalUserHelper(SSOSettings _settings) : base(_settings) { }
public ERPUserHelper(SSOSettings _settings) : base(_settings) { }
public static (Mock <ITokenProviderFactory> factoryMock, Mock <IOptions <SSOSettings> > optionsMock) CreateMocks(SSOSettings settings) { var factoryMock = new Mock <ITokenProviderFactory>(); factoryMock.Setup(x => x.Create(It.IsAny <TokenProviderSettings>())).Returns(() => new Mock <ITokenProvider>().Object); var optionsMock = new Mock <IOptions <SSOSettings> >(); optionsMock.Setup(x => x.Value).Returns(settings); return(factoryMock, optionsMock); }
public ThreadUserHelper(SSOSettings _settings) : base(_settings) { }
public UserHelper(SSOSettings _settings) { settings = _settings; }
public ServiceUserHelper(SSOSettings _settings) : base(_settings) { }