abstract class PublicApi

Overview

This action accepts both Login and BearerLogin tokens for delegated authorization purposes.

Use this to build an API to be consumed by the public, and by third-party applications.

Because any token type is accepted, bearer tokens retrieved from the Authorization header MUST NOT be used as proof of authentication.

Included Modules

Direct Known Subclasses

Defined in:

actions/public_api.cr

Constant Summary

AFTER_PIPES = [set_previous_page_url] of Symbol

This action accepts both Login and BearerLogin tokens for delegated authorization purposes.

Use this to build an API to be consumed by the public, and by third-party applications.

Because any token type is accepted, bearer tokens retrieved from the Authorization header MUST NOT be used as proof of authentication.

BEFORE_PIPES = [verify_accepted_format, disable_caching, require_logged_in, require_logged_out, pin_login_to_ip_address, enforce_login_idle_timeout, check_authorization] of Symbol

This action accepts both Login and BearerLogin tokens for delegated authorization purposes.

Use this to build an API to be consumed by the public, and by third-party applications.

Because any token type is accepted, bearer tokens retrieved from the Authorization header MUST NOT be used as proof of authentication.

EXPOSURES = [] of Symbol

This action accepts both Login and BearerLogin tokens for delegated authorization purposes.

Use this to build an API to be consumed by the public, and by third-party applications.

Because any token type is accepted, bearer tokens retrieved from the Authorization header MUST NOT be used as proof of authentication.

PARAM_DECLARATIONS = [] of Crystal::Macros::TypeDeclaration

This action accepts both Login and BearerLogin tokens for delegated authorization purposes.

Use this to build an API to be consumed by the public, and by third-party applications.

Because any token type is accepted, bearer tokens retrieved from the Authorization header MUST NOT be used as proof of authentication.

ROUTE_SETTINGS = {prefix: "/api/v0"}

This action accepts both Login and BearerLogin tokens for delegated authorization purposes.

Use this to build an API to be consumed by the public, and by third-party applications.

Because any token type is accepted, bearer tokens retrieved from the Authorization header MUST NOT be used as proof of authentication.

SKIPPED_PIPES = [pin_login_to_ip_address] of Symbol

This action accepts both Login and BearerLogin tokens for delegated authorization purposes.

Use this to build an API to be consumed by the public, and by third-party applications.

Because any token type is accepted, bearer tokens retrieved from the Authorization header MUST NOT be used as proof of authentication.

Class Method Summary

Instance Method Summary

Class Method Detail

def self._accepted_formats #

Instance Method Detail

def authorize?(user : User) : Bool #

[View source]
def authorize?(user : Shield::User) : Bool #

def bearer_logged_in? : Bool #

[View source]
def bearer_logged_out? : Bool #

[View source]
def bearer_scope : String #

[View source]
def check_authorization #

[View source]
def current_bearer : User #

[View source]
def current_bearer? : User | Nil #

def current_bearer_login #

[View source]
def current_bearer_login? : BearerLogin | Nil #

def current_login #

def current_login? : Login | Nil #

def current_user #

def current_user? : User | Nil #

def current_user_or_bearer : User #

[View source]
def current_user_or_bearer? : User | Nil #

[View source]
def disable_caching #

def do_check_authorization_failed #

def do_enforce_login_idle_timeout_failed #

def do_pin_email_confirmation_to_ip_address_failed #

[View source]
def do_pin_login_to_ip_address_failed #

def do_pin_password_reset_to_ip_address_failed #

[View source]
def do_require_logged_in_failed #

def do_require_logged_out_failed #

def enforce_login_idle_timeout #

def logged_in? : Bool #

def logged_out? : Bool #

def pin_email_confirmation_to_ip_address #

[View source]
def pin_login_to_ip_address #

def pin_password_reset_to_ip_address #

[View source]
def previous_page_url #

def previous_page_url? : String | Nil #

def redirect_back(*, fallback : Lucky::Action.class, status : HTTP::Status, allow_external = false) #

def redirect_back(*, fallback : Lucky::RouteHelper, status : HTTP::Status, allow_external = false) #

def redirect_back(*, fallback : String, status : Int32 = 302, allow_external : Bool = false) #
Description copied from module Lucky::Redirectable

Redirects the browser to the page that issued the request (the referrer) if possible, otherwise redirects to the provided default fallback location.

The referrer information is pulled from the 'Referer' header on the request. This is an optional header, and if the request is missing this header the fallback will be used.

redirect_back fallback: "/users"

A redirect status can be specified

redirect_back fallback: "/home", status: 301

External referers are ignored by default. It is determined by comparing the referer header to the request host. They can be explicitly allowed if necessary

redirect_back fallback: "/home", allow_external: true


def remote_ip : Socket::IPAddress #

def remote_ip? : Socket::IPAddress | Nil #

def require_logged_in #

[View source]
def require_logged_out #

[View source]
def return_url #

def return_url? : String | Nil #

def set_no_referrer_policy #

def set_previous_page_url #