Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsASMediaType ¶ added in v0.10.0
IsASMediaType will return whether the given content-type string matches one of the 2 possible ActivityStreams incoming content types: - application/activity+json - application/ld+json;profile=https://w3.org/ns/activitystreams
Where for the above we are leniant with whitespace and quotes.
Types ¶
type Federator ¶
type Federator interface { // FederatingActor returns the underlying pub.FederatingActor, which can be used to send activities, and serve actors at inboxes/outboxes. FederatingActor() pub.FederatingActor // FederatingDB returns the underlying FederatingDB interface. FederatingDB() federatingdb.DB // TransportController returns the underlying transport controller. TransportController() transport.Controller // AuthenticateFederatedRequest can be used to check the authenticity of incoming http-signed requests for federating resources. // The given username will be used to create a transport for making outgoing requests. See the implementation for more detailed comments. // // If the request is valid and passes authentication, the URL of the key owner ID will be returned, as well as true, and nil. // // If the request does not pass authentication, or there's a domain block, nil, false, nil will be returned. // // If something goes wrong during authentication, nil, false, and an error will be returned. AuthenticateFederatedRequest(ctx context.Context, username string) (*PubKeyAuth, gtserror.WithCode) pub.CommonBehavior pub.FederatingProtocol dereferencing.Dereferencer }
Federator wraps various interfaces and functions to manage activitypub federation from gotosocial
func NewFederator ¶
func NewFederator(state *state.State, federatingDB federatingdb.DB, transportController transport.Controller, converter *typeutils.Converter, mediaManager *media.Manager) Federator
NewFederator returns a new federator
type PubKeyAuth ¶ added in v0.12.0
type PubKeyAuth struct { // CachedPubKey is the public key found in the db // for the Actor whose request we're now authenticating. // Will be set only in cases where we had the Owner // of the key stored in the database already. CachedPubKey *rsa.PublicKey // FetchedPubKey is an up-to-date public key fetched // from the remote instance. Will be set in cases // where EITHER we hadn't seen the Actor before whose // request we're now authenticating, OR a CachedPubKey // was found in our database, but was expired. FetchedPubKey *rsa.PublicKey // OwnerURI is the ActivityPub id of the owner of // the public key used to sign the request we're // now authenticating. This will always be set // even if Owner isn't, so that callers can use // this URI to go fetch the Owner from remote. OwnerURI *url.URL // Owner is the account corresponding to OwnerURI. // // Owner will only be defined if the account who // owns the public key was already cached in the // database when we received the request we're now // authenticating (ie., we've seen it before). // // If it's not defined, callers should use OwnerURI // to go and dereference it. Owner *gtsmodel.Account }
PubKeyAuth models authorization information for a remote Actor making a signed HTTP request to this GtS instance using a public key.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.