UserAuthModifier

public final class UserAuthModifier<
    A: AuthEndpoint
>: RestModifier<A>, AuthEndpoint
where A.QuerySubject: CorvusModelAuthenticatable

A class that wraps a component which utilizes an .userAuth() modifier. That allows Corvus to chain modifiers, as it gets treated as any other struct conforming to AuthEndpoint.

  • A method which checks if the user supplied in the Request is equal to the user belonging to the particular QuerySubject.

    Throws

    An Abort error if an item is not found.

    Declaration

    Swift

    override public func handler(_ req: Request)
        throws -> EventLoopFuture<Element>

    Parameters

    req

    An incoming Request.

    Return Value

    An EventLoopFuture containing an eagerloaded value as defined by Element. If authorization fails or a user is not found, HTTP .unauthorized and .notFound are thrown respectively.