simple-security

1.2.2 • Public • Published

simple-security

Simple security library to work with firebase

Example in firebase

exports.endpoint = onRequest( async (request, response) => {
    if ( await simpleSecurity(request, { allow_jwt:false, allow_s2s:true, allow_basic:false }) ){
        if (request.method === "POST"){
            //....
        }
        return response.sendStatus(405);
    }else{
        return response.sendStatus(403);
    }
}

Required Env variables:

  • AUTHENTICATION_FIREBASE_API_KEY
  • AUTHENTICATION_FIREBASE_AUTH_DOMAIN
  • AUTHENTICATION_FIREBASE_PROJECT_ID
  • AUTHENTICATION_FIREBASE_STORAGE_BUCKET
  • AUTHENTICATION_FIREBASE_MESSAGEING_SENDER_ID
  • AUTHENTICATION_FIREBASE_APP_ID

BOOLEANS: true means that is uuid header is required on S2S auth

  • SECURITY_S2S_UUID_REQUIRED
  • DEFAUT_ALLOW_JWT
  • DEFAULT_ALLOW_BASIC
  • DEFAULT_ALLOW_S2S
  • DEFAULT_JWT_BLOCK_ANONYMUS
  • REQUIRE_UUID_ON_JWT
  • REQUIRE_UUID_ON_BASIC

TOKENS

  • AUTHENTICATION_S2S_TOKEN
  • API_TOKEN_URL_VALIDATOR

/simple-security/

    Package Sidebar

    Install

    npm i simple-security

    Weekly Downloads

    3

    Version

    1.2.2

    License

    ISC

    Unpacked Size

    10.6 kB

    Total Files

    14

    Last publish

    Collaborators

    • ericmora