Code Monkey home page Code Monkey logo

cypress-iap-windows's Introduction

coltdorsey/cypress-iap npm version cypress-iap status

Cypress Identity Aware Proxy(IAP)

This Cypress plugin overwrites the cy.visit command and builds authentication capability google-auth-library to access applications behind Identity Aware Proxy(IAP). If the the cypress baseUrl is localhost, the original cy.visit function is returned.

Installation

Install the package using npm:

npm i -D cypress-iap

And add the following at the beginning of your setup file at cypress/support/index.js:

import 'cypress-iap/visit';

Register the plugin

Register the plugin in your cypress/plugins/index.js file like this:

module.exports = (on, config) => {
    require('cypress-iap/utils')(on, config);

    return config;
};

Google Service Account

A google service account should be created within your google cloud project. Upon creation, store the keyfile that is auto generated.

Create a google service account

Do NOT check this file in to your remote repository. Store it outside of your project or .gitignore / .dockerignore your keyfile.

Example google cloud service account

keyfile.json

{
  "type": "service_account",
  "project_id": "<project_id>",
  "private_key_id": "<private_key_id",
  "private_key": "-----BEGIN PRIVATE KEY-----\n <private_key> \n-----END PRIVATE KEY-----\n",
  "client_email": "<service_account_name>@<google_cloud_project>.iam.gserviceaccount.com",
  "client_id": "<client_id>",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/<google_clould_project>.iam.gserviceaccount.com"
}

Set GOOGLE_APPLICATION_CREDENTIALS env variable

Ensure the GOOGLE_APPLICATION_CREDENTIALS environment variable is set to the credentials path of the credentials file.

export GOOGLE_APPLICATION_CREDENTIALS=path/to/keyfile.json

Alternatively you can use third party plugin called as-a and in your as-a.ini you can set the following configuration:

as-a.ini

[auth-me]
GOOGLE_APPLICATION_CREDENTIALS=keyfile.json

This command will execute the as-a package set the variables defined under [auth-me].

as-a auth-me cypress run

cypress-iap-windows's People

Watchers

 avatar

cypress-iap-windows's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.