Socket
Socket
Sign inDemoInstall

@gemeentenijmegen/webapp

Package Overview
Dependencies
15
Maintainers
5
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @gemeentenijmegen/webapp

This packages provides the building blocks to create a standardized webapp. It contains both infrastructure (CloudFront, S3 buckets etc.) as application code (login/authetnication)


Version published
Weekly downloads
36
decreased by-67.86%
Maintainers
5
Created
Weekly downloads
 

Readme

Source

Generic webapp

This packages provides the building blocks to create a standardized webapp. It contains both infrastructure (CloudFront, S3 buckets etc.) as application code (login/authetnication)

Usage

Creating the webapp foundation is easy.

/**
 * Create the webapp!
 */
const webapp = new WebappConstruct(this, 'app', {
  applicationName: Statics.projectName,
  cloudFrontCertificate: certificate,
  domainName: `${hostedZone.zoneName}`,
  additionalSourceFilesDir: 'src/resources',
  hostedZone: hostedZone,
  staticResourcesDirectory: './src/app/static-resources/',
  defaultPath: '/home',
  postLoginProcessor: this.postLoginHook(secretBrpMtlsPrivateKey, ssmBrpMtlsCertficate, ssmBrpMtlsRootCa),
  oidcProfiles: props.configuration.oidcProfiles,
});
Post login processor Example on how to setup a post login processor function
  /**
   * Constrcut a post-login hook function that is passed directly
   * to the webapp. It will register the function and redirect trafic
   * there after the pre-login (auth lambda).
   * @returns
   */
  postLoginHook(privateKey: ISecret, cert: IStringParameter, rootCa: IStringParameter) {
    const hook = new ApiFunction(this, 'post-login-function', {
      description: 'Post-login lambda',
      apiFunction: PostloginFunction,
      environment: {
        BRP_API_URL: StringParameter.valueForStringParameter(this, Statics.ssmBrpApiEndpointUrl),
        MTLS_PRIVATE_KEY_ARN: privateKey.secretArn,
        MTLS_CLIENT_CERT_NAME: Statics.ssmBrpMtlsCertificate,
        MTLS_ROOT_CA_NAME: Statics.ssmBrpMtlsRootCA,
      },
    });
    privateKey.grantRead(hook.lambda);
    cert.grantRead(hook.lambda);
    rootCa.grantRead(hook.lambda);
    return hook;
  }

Adding multiple pages

/**
 * Add a home page to the webapp
 * @param webapp
 */
addHomePage(webapp: WebappConstruct) {
  const homeFunction = new ApiFunction(this, 'home-function', {
    description: 'Home lambda',
    apiFunction: HomeFunction,
  });
  webapp.addPage('home', homeFunction, '/home');
}

Keywords

FAQs

Last updated on 19 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc