2019-04-24 21:52:08 +00:00
|
|
|
package duo
|
|
|
|
|
2020-03-01 00:51:11 +00:00
|
|
|
import (
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
"github.com/authelia/authelia/internal/middlewares"
|
|
|
|
)
|
2019-04-24 21:52:08 +00:00
|
|
|
import "github.com/duosecurity/duo_api_golang"
|
|
|
|
|
|
|
|
// API interface wrapping duo api library for testing purpose
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
// APIImpl implementation of DuoAPI interface
|
|
|
|
type APIImpl struct {
|
|
|
|
*duoapi.DuoApi
|
|
|
|
}
|
|
|
|
|
|
|
|
// Response response coming from Duo API
|
|
|
|
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
|
|
|
}
|