Learn R Programming

fireproof

fireproof is a plugin for fiery based servers. It provides a unified framework for adding authentication to your server backend.

fireproof supports multiple authentication routes for each endpoint so that you can specify that access to a certain endpoint requires either passing this and/or this challenges. The logic can be arbitrarily complex though for your own sanity it probably shouldn’t.

Installation

fireproof can be installed from CRAN with install.packages("fireproof"). Alternatively, you can install the development version of fireproof from GitHub with:

# install.packages("pak")
pak::pak("thomasp85/fireproof")

Example

This is a basic example which shows you how to solve a common problem:

library(fireproof)

# Create the plugin
proof <- Fireproof$new()

# Create two different guards
key_auth <- guard_key(
  key_name = "FireproofKey",
  validate = "VerySecretString",
  cookie = FALSE
)
basic_auth <- guard_basic(
  validate = function(user, password, ...) {
    user == "thomas" && password == "1234"
  }
)

# Add them to the plugin
proof$add_guard(key_auth, "key")
proof$add_guard(basic_auth, "basic")

# Add authentication to some endpoints with varying combinations of requirements
proof$add_auth("get", "/user/settings", basic) # must pass basic auth
proof$add_auth("get", "/api/predict", key || basic) # must pass either
proof$add_auth("get", "/strong/auth", key && basic) # must pass both

# If you have even more authenticators you can group conditions with () as well


# Create a fiery app with a firestore plugin and attach the plugin
app <- fiery::Fire$new()
fs <- firesale::FireSale$new(storr::driver_environment())
app$attach(fs)

app$attach(proof)

OAuth 2.0 and OpenID Connect

A lot of authorization on the internet has moved towards OAuth 2.0 and the authentication layer build on top of it (OpenID Connect). fireproof supports both of these and have basic constructors for both flows that take the required authorization or discovery endpoints and takes care of the rest. It also comes with a selection of predefined constructors for well-known providers such as Google and GitHub that makes it easy to use them. If you want to use another provider than one already available I’ll invite you create a PR for it based on how the current providers have been implemented. In this way we can gradually grow the number of providers offered out of the box based on what the community needs.

Current OAuth/OpenID Connect support

  • Google✽
  • GitHub
  • Beeceptor (Used for mocking)

OpenID Connect

Copy Link

Version

Install

install.packages('fireproof')

Version

0.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Thomas Lin Pedersen

Last Published

December 17th, 2025

Functions in fireproof (0.1.0)

prune_openapi

Ensure consistency of OpenAPI auth description
new_user_info

Well structured user information
guard_oidc

Guard based on OpenID Connect
guard_bearer

Bearer authentication guard
guard_oauth2

Guard based on OAuth 2.0
guard_github

Guard for authenticating with the GitHub OAuth 2.0 server
on_auth

Predefined functions for handling successful OAuth 2.0 authentication
guard_google

Guard for Authenticating with the Google OpenID Connect server
guard_beeceptor

Guard using the mock OAuth servers provided by Beeceptor
guard_key

Shared secret guard
GuardBasic

R6 class for the Basic authentication guard
GuardBearer

R6 class for the Bearer authentication guard
Fireproof

A plugin that handles authentication and/or authorization
GuardOIDC

R6 class for the OpenID Connect guard
GuardKey

R6 class for the Key guard
GuardOAuth2

R6 class for the OAuth 2.0 Guard
Guard

R6 base class for guards
guard_basic

Basic authentication guard
get_path

Extract the path from a URL
fireproof-package

fireproof: Authentication and Authorization for 'fiery' Servers