mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-10-29 09:07:30 +08:00
59 lines
1.3 KiB
Go
59 lines
1.3 KiB
Go
package plg_authenticate_openid
|
|
|
|
import (
|
|
. "github.com/mickael-kerjean/filestash/server/common"
|
|
"net/http"
|
|
)
|
|
|
|
func init() {
|
|
Hooks.Register.AuthenticationMiddleware("openid", OpenID{})
|
|
}
|
|
|
|
type OpenID struct{}
|
|
|
|
func (this OpenID) Setup() Form {
|
|
return Form{
|
|
Elmnts: []FormElement{
|
|
{
|
|
Name: "type",
|
|
Type: "hidden",
|
|
Value: "openid",
|
|
},
|
|
{
|
|
Name: "OpenID Config URL",
|
|
Type: "text",
|
|
ReadOnly: true,
|
|
Value: "",
|
|
Placeholder: "<VISIT https://www.filestash.app/pricing>",
|
|
},
|
|
{
|
|
Name: "Client ID",
|
|
Type: "text",
|
|
ReadOnly: true,
|
|
Value: "",
|
|
Placeholder: "<VISIT https://www.filestash.app/pricing>",
|
|
},
|
|
{
|
|
Name: "Scope",
|
|
Type: "text",
|
|
ReadOnly: true,
|
|
Value: "",
|
|
Placeholder: "<VISIT https://www.filestash.app/pricing>",
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
func (this OpenID) EntryPoint(idpParams map[string]string, req *http.Request, res http.ResponseWriter) error {
|
|
http.Redirect(
|
|
res, req,
|
|
"/?error=oidc is available for enterprise customer, see https://www.filestash.app/pricing/?modal=enterprise",
|
|
http.StatusTemporaryRedirect,
|
|
)
|
|
return nil
|
|
}
|
|
|
|
func (this OpenID) Callback(formData map[string]string, idpParams map[string]string, res http.ResponseWriter) (map[string]string, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|