internal Sessions(Context context, Persistence.DataContext dataContext)
        {
            this.dataContext = dataContext;
            this.context     = context;

            telemetry = EastFive.Azure.AppSettings.ApplicationInsights.InstrumentationKey.LoadTelemetryClient();
        }
Exemplo n.º 2
0
 internal PasswordCredentials(Context context, Persistence.DataContext dataContext)
 {
     this.dataContext = dataContext;
     this.context     = context;
     // TODO: Refactor this class so it works with any Management Provider
     context.GetManagementProvider(CredentialValidationMethodTypes.Password,
                                   (identityService) =>
     {
         this.managmentProvider = identityService;
         return(true);
     },
                                   () => false,
                                   (why) => false);
 }
Exemplo n.º 3
0
        internal Sessions(Context context, Persistence.DataContext dataContext)
        {
            this.dataContext = dataContext;
            this.context     = context;

            telemetry = Web.Configuration.Settings.GetString(SessionServer.Configuration.AppSettings.ApplicationInsightsKey,
                                                             (applicationInsightsKey) =>
            {
                return(new TelemetryClient {
                    InstrumentationKey = applicationInsightsKey
                });
            },
                                                             (why) =>
            {
                return(new TelemetryClient());
            });
        }
Exemplo n.º 4
0
 public TokenCredentialProvider()
 {
     this.dataContext = new DataContext(EastFive.Azure.AppSettings.ASTConnectionStringKey);
 }
Exemplo n.º 5
0
 internal LoginProviders(Context context, Persistence.DataContext dataContext)
 {
     this.dataContext = dataContext;
     this.context     = context;
 }
 internal Claims(Context context, Persistence.DataContext dataContext)
 {
     this.dataContext = dataContext;
     this.context     = context;
 }
 internal Credentials(Context context, Persistence.DataContext dataContext)
 {
     this.dataContext = dataContext;
     this.context     = context;
 }
 internal Authorizations(Context context, Persistence.DataContext dataContext)
 {
     this.dataContext = dataContext;
     this.context     = context;
 }
        //internal static Dictionary<CredentialValidationMethodTypes, IProvideAccess> accessProviders =
        //    default(Dictionary<CredentialValidationMethodTypes, IProvideAccess>);

        public static async Task <TResult> InitializeAsync <TResult>(IConfigureIdentityServer configurationManager,
                                                                     HttpConfiguration config,
                                                                     Func <
                                                                         Func <IProvideAuthorization, IProvideAuthorization[]>, // onProvideAuthorization
                                                                         Func <IProvideAuthorization[]>,                        // onProvideNothing
                                                                         Func <string, IProvideAuthorization[]>,                // onFailure
                                                                         Task <IProvideAuthorization[]> > [] initializers,
                                                                     Func <TResult> onSuccess,
                                                                     Func <string, TResult> onFailure)
        {
            Library.configurationManager = configurationManager;
            //config.AddExternalControllers<SessionServer.Api.Controllers.OpenIdResponseController>();
            AddExternalControllers <Api.Controllers.OpenIdResponseController>(config);
            //return InitializeAsync(audience, configurationEndpoint, onSuccess, onFailed);
            config.Routes.MapHttpRoute(name: "apple-app-links",
                                       routeTemplate: "apple-app-site-association",
                                       defaults: new { controller = "AppleAppSiteAssociation", id = RouteParameter.Optional });

            var dataContext = new Persistence.DataContext(Configuration.AppSettings.Storage);
            var credentialProvidersWithoutMethods = await initializers.Aggregate(
                (new IProvideAuthorization[] { }).ToTask(),
                async (providersTask, initializer) =>
            {
                var providers = await providersTask;
                return(await initializer(
                           (service) => providers.Append(service).ToArray(),
                           () => providers,
                           (why) => providers));
            });

            credentialProviders = credentialProvidersWithoutMethods
                                  .ToDictionary(
                credentialProvider => credentialProvider.Method,
                credentialProvider => credentialProvider);
            loginProviders = credentialProvidersWithoutMethods
                             .Where(credentialProvider => typeof(IProvideLogin).IsAssignableFrom(credentialProvider.GetType()))
                             .ToDictionary(
                credentialProvider => credentialProvider.Method,
                credentialProvider => (IProvideLogin)credentialProvider);
            managementProviders = credentialProvidersWithoutMethods
                                  .Where(credentialProvider => typeof(IProvideLoginManagement).IsAssignableFrom(credentialProvider.GetType()))
                                  .ToDictionary(
                credentialProvider => credentialProvider.Method,
                credentialProvider => (IProvideLoginManagement)credentialProvider);
            //accessProviders = credentialProvidersWithoutMethods
            //    .Where(credentialProvider => typeof(IProvideAccess).IsAssignableFrom(credentialProvider.GetType()))
            //    .ToDictionary(
            //        credentialProvider => credentialProvider.Method,
            //        credentialProvider => (IProvideAccess)credentialProvider);
            tokenProviders = credentialProvidersWithoutMethods
                             .Where(credentialProvider => typeof(IProvideToken).IsAssignableFrom(credentialProvider.GetType()))
                             .ToDictionary(
                credentialProvider => credentialProvider.Method,
                credentialProvider => (IProvideToken)credentialProvider);

            //var spaZipPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Spa.zip");
            //var zipArchive = ZipFile.OpenRead(spaZipPath);

            //var lookupSpaFile = zipArchive.Entries
            //    .Select(
            //        entity => entity.FullName.PairWithValue(entity.Open().ToBytes()))
            //    .ToDictionary();

            return(onSuccess());
        }
 internal Integrations(Context context, Persistence.DataContext dataContext)
 {
     this.dataContext = dataContext;
     this.context     = context;
 }
Exemplo n.º 11
0
 internal Health(Context context, Persistence.DataContext dataContext)
 {
     this.dataContext = dataContext;
     this.context     = context;
 }
 public Roles(Context context, Persistence.DataContext dataContext)
 {
     this.context     = context;
     this.dataContext = dataContext;
 }
Exemplo n.º 13
0
 internal Accesses(Context context, Persistence.DataContext dataContext)
 {
     this.dataContext = dataContext;
     this.context     = context;
 }