mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
828f565290
This is going to be the v4. Expected improvements: - More reliable due to static typing. - Bump of performance. - Improvement of logging. - Authelia can be shipped as a single binary. - Will likely work on ARM architecture.
33 lines
582 B
Go
33 lines
582 B
Go
package duo
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/url"
|
|
|
|
"github.com/duosecurity/duo_api_golang"
|
|
)
|
|
|
|
// NewDuoAPI create duo API instance
|
|
func NewDuoAPI(duoAPI *duoapi.DuoApi) *APIImpl {
|
|
api := new(APIImpl)
|
|
api.DuoApi = duoAPI
|
|
return api
|
|
}
|
|
|
|
// Call call to the DuoAPI
|
|
func (d *APIImpl) Call(values url.Values) (*Response, error) {
|
|
_, responseBytes, err := d.DuoApi.SignedCall("POST", "/auth/v2/auth", values)
|
|
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
var response Response
|
|
err = json.Unmarshal(responseBytes, &response)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &response, nil
|
|
}
|