Esempio n. 1
0
        /// <summary>
        /// https://duo.com/docs/authapi#/preauth
        /// </summary>
        /// <param name="user_id">Permanent, unique identifier for the user as generated by Duo upon user creation (e.g. DUYHV6TJBC3O4RITS1WC). Exactly one of user_id and username must be specified.</param>
        /// <param name="ipaddr">The IP address of the user to be authenticated, in dotted quad format. This will cause an "allow" response to be sent if appropriate for requests from a trusted network.</param>
        /// <param name="trusted_device_token">If the trusted_device_token is present and the Remembered Devices option is enabled in the Duo Admin Panel, return an "allow" response for the period of time a device may be remembered as set by the Duo administrator.</param>
        public async Task <DuoResponse <PreAuthResult> > PreAuthByUserIdAsync(string user_id, string ipaddr = null, string trusted_device_token = null)
        {
            var request  = builder.PreAuthRequest(user_id, null, ipaddr, trusted_device_token);
            var response = await client.SendAsync(request).ConfigureAwait(false);

            return(await DuoResponse.ParseAsync <PreAuthResultModel, PreAuthResult>(response));
        }