mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 13:09:22 -06:00
e6b8a1529b
* Add SAML configuration options * Add crewjam/saml as a depdency Needed as part of the enterprise SAML integration. * Vendor github.com/stretchr/testify/require The package require implements the same assertions as the `assert` package but stops test execution when a test fails.
30 lines
772 B
Go
30 lines
772 B
Go
package saml
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"time"
|
|
|
|
dsig "github.com/russellhaering/goxmldsig"
|
|
)
|
|
|
|
// TimeNow is a function that returns the current time. The default
|
|
// value is time.Now, but it can be replaced for testing.
|
|
var TimeNow = func() time.Time { return time.Now().UTC() }
|
|
|
|
// Clock is assigned to dsig validation and signing contexts if it is
|
|
// not nil, otherwise the default clock is used.
|
|
var Clock *dsig.Clock
|
|
|
|
// RandReader is the io.Reader that produces cryptographically random
|
|
// bytes when they are need by the library. The default value is
|
|
// rand.Reader, but it can be replaced for testing.
|
|
var RandReader = rand.Reader
|
|
|
|
func randomBytes(n int) []byte {
|
|
rv := make([]byte, n)
|
|
if _, err := RandReader.Read(rv); err != nil {
|
|
panic(err)
|
|
}
|
|
return rv
|
|
}
|