public IcelandAuthController(Umbraco.Core.Logging.ILogger logger)
        {
            Log = logger;
            var log = new UmbracoLogger(Log, typeof(IcelandAuthService));
            var icelandAuthService = new IcelandAuthService(log);

            AuthHandler = new ControllerBehavior(icelandAuthService);
        }
        public IcelandAuthController()
        {
            Log = LogManager.GetLogger(typeof(IcelandAuthService));
            var log = new Log4NetLogger(Log);
            var icelandAuthService = new IcelandAuthService(log);

            AuthHandler = new ControllerBehavior(icelandAuthService);
        }
        public void Init()
        {
            var configuration = SimpleConfiguration.Create();

            SimpleConfiguration.SetSection(configuration, "IcelandAuth:Audience", "icelandauth.vettvangur.is");
            SimpleConfiguration.SetSection(configuration, "IcelandAuth:Destination", "https://icelandauth.vettvangur.is/umbraco/surface/icelandauth/login");
            SimpleConfiguration.SetSection(configuration, "IcelandAuth:DestinationSSN", "5208130550");

            svc = new IcelandAuthService(configuration.Object, null);
        }
        public ControllerBehavior(IcelandAuthService icelandAuthService)
        {
            IcelandAuthService = icelandAuthService;

            SuccessRedirect = string.IsNullOrEmpty(ConfigurationManager.AppSettings["IcelandAuth.SuccessRedirect"])
                ? "/"
                : ConfigurationManager.AppSettings["IcelandAuth.SuccessRedirect"];
            ErrorRedirect = string.IsNullOrEmpty(ConfigurationManager.AppSettings["IcelandAuth.ErrorRedirect"])
                ? "/"
                : ConfigurationManager.AppSettings["IcelandAuth.ErrorRedirect"];
        }
        public IActionResult Index()
        {
            SamlLogin login = null;

            if (Request.Method == "POST" && Request.Form.ContainsKey("token"))
            {
                var authSvc = new IcelandAuthService(_configuration, _logger);
                login = authSvc.VerifySaml(Request.Form["token"], HttpContext.Connection.RemoteIpAddress.ToString());
            }

            return(View(login));
        }