private ActionResult ByPassSamlSession(string login, string samlSessionId)
        {
            var client     = new MultiFactorApiClient();
            var bypassPage = client.CreateSamlBypassRequest(login, samlSessionId);

            return(View("ByPassSamlSession", bypassPage));
        }
Ejemplo n.º 2
0
        public RadiusRouter(ServiceConfiguration serviceConfiguration, IRadiusPacketParser packetParser, ILogger logger)
        {
            _serviceConfiguration = serviceConfiguration ?? throw new ArgumentNullException(nameof(serviceConfiguration));
            _packetParser         = packetParser ?? throw new ArgumentNullException(nameof(packetParser));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            _multifactorApiClient = new MultiFactorApiClient(serviceConfiguration, logger);
        }
Ejemplo n.º 3
0
        public RadiusRouter(Configuration configuration, IRadiusPacketParser packetParser, ILogger logger)
        {
            _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            _packetParser  = packetParser ?? throw new ArgumentNullException(nameof(packetParser));
            _logger        = logger ?? throw new ArgumentNullException(nameof(logger));

            _multifactorApiClient   = new MultiFactorApiClient(configuration, logger);
            _activeDirectoryService = new ActiveDirectoryService(configuration, logger);
            _ldapService            = new LdapService(configuration, logger);
        }
        private ActionResult RedirectToMfa(string login, string displayName, string email, string phone, string documentUrl, string samlSessionId, bool mustResetPassword = false)
        {
            //public url from browser if we behind nginx or other proxy
            var currentUri    = new Uri(documentUrl);
            var noLastSegment = string.Format("{0}://{1}", currentUri.Scheme, currentUri.Authority);

            for (int i = 0; i < currentUri.Segments.Length - 1; i++)
            {
                noLastSegment += currentUri.Segments[i];
            }

            noLastSegment = noLastSegment.Trim("/".ToCharArray()); // remove trailing /

            var postbackUrl = noLastSegment + "/PostbackFromMfa";

            //exra params
            var claims = new Dictionary <string, string>
            {
                { MultiFactorClaims.RawUserName, login }    //as specifyed by user
            };

            if (mustResetPassword)
            {
                claims.Add(MultiFactorClaims.ChangePassword, "true");
            }
            else
            {
                if (samlSessionId != null)
                {
                    claims.Add(MultiFactorClaims.SamlSessionId, samlSessionId);
                }
            }


            var client     = new MultiFactorApiClient();
            var accessPage = client.CreateAccessRequest(login, displayName, email, phone, postbackUrl, claims);

            return(RedirectPermanent(accessPage.Url));
        }