2019-04-24 21:52:08 +00:00
|
|
|
package duo
|
|
|
|
|
2020-03-01 00:51:11 +00:00
|
|
|
import (
|
|
|
|
"net/url"
|
|
|
|
|
2020-04-05 12:37:21 +00:00
|
|
|
duoapi "github.com/duosecurity/duo_api_golang"
|
|
|
|
|
2021-08-11 01:04:35 +00:00
|
|
|
"github.com/authelia/authelia/v4/internal/middlewares"
|
2020-03-01 00:51:11 +00:00
|
|
|
)
|
2019-04-24 21:52:08 +00:00
|
|
|
|
2020-05-02 05:06:39 +00:00
|
|
|
// API interface wrapping duo api library for testing purpose.
|
2019-04-24 21:52:08 +00:00
|
|
|
type API interface {
|
2020-03-01 00:51:11 +00:00
|
|
|
Call(values url.Values, ctx *middlewares.AutheliaCtx) (*Response, error)
|
2019-04-24 21:52:08 +00:00
|
|
|
}
|
|
|
|
|
2020-05-02 05:06:39 +00:00
|
|
|
// APIImpl implementation of DuoAPI interface.
|
2019-04-24 21:52:08 +00:00
|
|
|
type APIImpl struct {
|
|
|
|
*duoapi.DuoApi
|
|
|
|
}
|
|
|
|
|
2020-05-02 05:06:39 +00:00
|
|
|
// Response response coming from Duo API.
|
2019-04-24 21:52:08 +00:00
|
|
|
type Response struct {
|
|
|
|
Response struct {
|
|
|
|
Result string `json:"result"`
|
|
|
|
Status string `json:"status"`
|
|
|
|
StatusMessage string `json:"status_msg"`
|
|
|
|
} `json:"response"`
|
2020-03-01 00:51:11 +00:00
|
|
|
Code int `json:"code"`
|
|
|
|
Message string `json:"message"`
|
|
|
|
MessageDetail string `json:"message_detail"`
|
|
|
|
Stat string `json:"stat"`
|
2019-04-24 21:52:08 +00:00
|
|
|
}
|