public static IAppBuilder UseClaimsTransformation(this IAppBuilder app, ClaimsAuthenticationManager manager)
 {
     return app.UseClaimsTransformation(new ClaimsTransformationOptions
     {
         ClaimsAuthenticationManager = manager
     });
 }
 public OwinAuthenticationService(
     UserAccountService svc,
     IDictionary<string, object> environment,
     ClaimsAuthenticationManager transformer
 )
     : base(svc, transformer)
 {
     context = new OwinContext(environment);
 }
        public ClaimsTransformationMiddleware(OwinMiddleware next, ClaimsAuthenticationManager claimsAuthenticationManager) : base(next)
        {
            if (claimsAuthenticationManager == null)
            {
                throw new ArgumentNullException("claimsAuthenticationManager");
            }

            _claimsAuthenticationManager = claimsAuthenticationManager;
        }
 public OwinAuthenticationService(
     string authenticationType,
     UserAccountService svc,
     IDictionary<string, object> env,
     ClaimsAuthenticationManager transformer
 )
     : base(svc, transformer)
 {
     this.authenticationType = authenticationType;
     context = new OwinContext(env);
 }
 public AuthenticationService(UserAccountService userService, ClaimsAuthenticationManager claimsAuthenticationManager)
 {
     this.UserAccountService = userService;
     this.ClaimsAuthenticationManager = claimsAuthenticationManager;
 }
        /// <summary>
        /// Loads the settings for the IdentityConfiguration from the application or web configuration file.
        /// </summary>
        /// <remarks>
        /// If there is no configuration file, or the named section does not exist, then no exception is thrown,
        /// instead the class is loaded with a set of default values.
        /// </remarks>
        protected void LoadConfiguration(IdentityConfigurationElement element)
        {

            if (element != null)
            {
                //
                // Load the claims authentication manager
                //
                if (element.ClaimsAuthenticationManager.IsConfigured)
                {
                    _claimsAuthenticationManager = GetClaimsAuthenticationManager(element);
                }

                //
                // Load the claims authorization manager.
                //
                if (element.ClaimsAuthorizationManager.IsConfigured)
                {
                    _claimsAuthorizationManager = CustomTypeElement.Resolve<ClaimsAuthorizationManager>(element.ClaimsAuthorizationManager);
                }

                //
                // Load the service level Security Token Handler configuration
                //
                _serviceHandlerConfiguration = LoadHandlerConfiguration(element);
            }

            //
            // Reads handler configuration via LoadConfiguredHandlers. Do this last.
            //
            _securityTokenHandlerCollectionManager = LoadHandlers(element);
        }
 public ClaimsTransformationHandler(ClaimsAuthenticationManager transformer, HttpConfiguration configuration)
 {
     _transfomer = transformer;
     InnerHandler = new HttpControllerDispatcher(configuration);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SharedKeyValidatingHandler" /> class.
 /// </summary>
 /// <param name="sharedSecretResolver">A function to resolve an account name to a shared secret.</param>
 /// <param name="maximumMessageAge">The maximum time period a message is considered valid for.</param>
 /// <param name="claimsAuthenticationManager">The claims authentication manager to use to transform claims.</param>
 public SharedKeyValidatingHandler(Func<string, byte[]> sharedSecretResolver, TimeSpan maximumMessageAge, ClaimsAuthenticationManager claimsAuthenticationManager)
     : this(sharedSecretResolver, maximumMessageAge)
 {
     this.ClaimsAuthenticationManager = claimsAuthenticationManager;
 }
 public ClaimsTransformationHandler(ClaimsAuthenticationManager transformer)
 {
     _transfomer = transformer;
 }
 public ClaimsTransformationHandler()
 {
     _transfomer = FederatedAuthentication.FederationConfiguration.IdentityConfiguration.ClaimsAuthenticationManager;
 }
Example #11
0
        void FederatedAuthentication_FederationConfigurationCreated(object sender, System.IdentityModel.Services.Configuration.FederationConfigurationCreatedEventArgs e)
        {
            var thisAssembly = Assembly.GetExecutingAssembly();
            var certificateStream = thisAssembly.GetManifestResourceStream(string.Format("IlluminateMVC.illuminate2.pfx"));
            if (certificateStream == null)
            {
                Logger.Error("problem getting x509 certificate from resource file");
            }
            
            var sessionHandler = SessionSecurity.RSASessionTokenHandler(certificateStream, "illuminate",e);

            
            //replace the default (DPAPI - that don't work in web-farm scenarios) session token handler with the new one
            e.FederationConfiguration.IdentityConfiguration.SecurityTokenHandlers.AddOrReplace(sessionHandler);

            Logger.Information(string.Format("set session token handler to a custom RSA hndler when starting Illumiante"));
            //get the claims auth manager that is configured in web.config
            var claimsManager = e.FederationConfiguration.IdentityConfiguration.ClaimsAuthenticationManager as
                                IlluminateClaimsAuthenticationManager;
            //set the extra properties on the claims manager that we cant set in config, the claims manager needs
            //database access so it can work out extra claims to add to the token and it needs to be able to log messages
            claimsManager.Database = DataBase;
            claimsManager.Log = Logger;

            ClaimsAuthenticationManager = claimsManager;

            Logger.Information(string.Format("created custom claims manager"));

        }
 public static IAppBuilder UseClaimsTransformation(this IAppBuilder app, ClaimsAuthenticationManager claimsAuthenticationManager)
 {
     app.Use(typeof(ClaimsTransformationMiddleware), claimsAuthenticationManager);
     return app;
 }