write basic OAuth driver
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
package auth
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
)
|
||||||
|
|
||||||
|
var oauthConfigs []oauth2.Config
|
||||||
|
|
||||||
|
func CreateTestOAuth() {
|
||||||
|
oauthEndpoint := oauth2.Endpoint{
|
||||||
|
AuthURL: "https://account.astraltech.xyz/application/o/authorize/",
|
||||||
|
TokenURL: "https://account.astraltech.xyz/application/o/token/",
|
||||||
|
}
|
||||||
|
|
||||||
|
oauthConfig := oauth2.Config{
|
||||||
|
ClientID: "stalwart-webui",
|
||||||
|
Scopes: []string{"user:email", "read:user"},
|
||||||
|
Endpoint: oauthEndpoint,
|
||||||
|
RedirectURL: "http://localhost:8080/callback",
|
||||||
|
}
|
||||||
|
oauthConfigs = append(oauthConfigs, oauthConfig)
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package auth
|
||||||
|
|
||||||
|
import "net/http"
|
||||||
|
|
||||||
|
// this is usually served at /callback
|
||||||
|
func OAuthCallback(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user