discourse.go 552 B

1234567891011121314151617181920212223242526272829
  1. package discourse
  2. import "github.com/google/uuid"
  3. type ApiConfig struct {
  4. Endpoint string
  5. ApiKey string
  6. ApiUser string
  7. }
  8. type SsoConfig struct {
  9. Endpoint string
  10. ReturnEndpoint string
  11. Secret string
  12. Uuid uuid.UUID
  13. }
  14. func GetSSORequestURL(config SsoConfig) string {
  15. url := generateSSORequestURL(config)
  16. return url
  17. }
  18. // ValidateSsoResponse - Validate the signature on the sso response
  19. func ValidateSsoResponse(sso, sig, secret string) bool {
  20. ssoDataSig := computeHmac256(sso, secret)
  21. return sig == ssoDataSig
  22. }