Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleCallbackCode ¶
HandleCallbackCode will handle the callback from the IndieAuth server to continue the next step of the auth flow.
Types ¶
type Profile ¶
type Profile struct { Name string `json:"name"` URL string `json:"url"` Photo string `json:"photo"` }
Profile represents optional profile data that is returned when completing the IndieAuth flow.
type Request ¶
type Request struct { Timestamp time.Time Endpoint *url.URL Redirect *url.URL // Outbound redirect URL to continue auth flow Callback *url.URL // Inbound URL to get auth flow results Me *url.URL UserID string DisplayName string CurrentAccessToken string ClientID string CodeVerifier string CodeChallenge string State string }
Request represents a single in-flight IndieAuth request.
type Response ¶
type Response struct { Me string `json:"me,omitempty"` Profile Profile `json:"profile,omitempty"` Error string `json:"error,omitempty"` ErrorDescription string `json:"error_description,omitempty"` }
Response the response returned when completing the IndieAuth flow.
type ServerAuthRequest ¶
type ServerAuthRequest struct { Timestamp time.Time ClientID string RedirectURI string CodeChallenge string State string Me string Code string }
ServerAuthRequest is n inbound request to authenticate against this Owncast instance.
func StartServerAuth ¶
func StartServerAuth(clientID, redirectURI, codeChallenge, state, me string) (*ServerAuthRequest, error)
StartServerAuth will handle the authentication for the admin user of this Owncast server. Initiated via a GET of the auth endpoint. https://indieweb.org/authorization-endpoint
type ServerProfile ¶
type ServerProfile struct { Name string `json:"name"` URL string `json:"url"` Photo string `json:"photo"` }
ServerProfile represents basic user-provided data about this Owncast instance.
type ServerProfileResponse ¶
type ServerProfileResponse struct { Me string `json:"me,omitempty"` Profile ServerProfile `json:"profile,omitempty"` // Error keys need to match the OAuth spec. Error string `json:"error,omitempty"` ErrorDescription string `json:"error_description,omitempty"` }
ServerProfileResponse is returned when an auth flow requests the final confirmation of the IndieAuth flow.
func CompleteServerAuth ¶
func CompleteServerAuth(code, redirectURI, clientID string, codeVerifier string) (*ServerProfileResponse, error)
CompleteServerAuth will verify that the values provided in the final step of the IndieAuth flow are correct, and return some basic profile info.