Coder Social home page Coder Social logo

andrauss / technovationslp-backend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from desarrolladorslp/technovationslp-backend

0.0 1.0 0.0 450 KB

This project is intended to be used by the organization taking care of Technovation program in San Luis Potosí, México

License: Apache License 2.0

Java 98.90% TSQL 1.10%

technovationslp-backend's Introduction

technovationslp-backend

Backend for Technovation app for San Luis Potosí, México community

To know more about the project take a look to our wiki

Build

To build the application it is required to have maven installed then execute:

mvn clean package

Run

To run the application execute:

java -DJWT_PUBLIC_KEY=<public key for JWT encoded as base64> \
     -DJWT_PRIVATE_KEY=<private key for JWT encoded as base64> \
     -DFIREBASE_DATABASE_URL=https://<project name>.firebaseio.com \
     -DFIREBASE_CONFIG=<json object provided by firebase for service account authentication encoded as base64 > \
      -jar target/technovation-backend-<version>.jar

It is recommend to add (anywhere between java and -jar)

-Xms256m -Xmx256m -XX:MaxMetaspaceSize=256m 

To save some resources when it is run locally

JWT configuration

To generate pair of keys for JWT you can follow the steps bellow:

  1. openssl genrsa -out jwt.pem to generate the pair of keys
  2. openssl rsa -in jwt.pem will show the private key
  3. openssl rsa -in jwt.pem -pubout will show the public key

Firebase configuration

In order to fill the parameters FIREBASE_DATABASE_URL and FIREBASE_CONFIG you'll need to create a firebase project under https://console.firebase.google.com

To get FIREBASE_CONFIG value go to Project configuration/Service accounts and then click on Generate new private key. You'll get a json file, copy the content and encoded it as base64. Use the encoded value for the parameter.

Note: Read first the section Dev environment on this document before create any firebase project it can be not needed at all

Note: The real configuration is provided vía environment variables and can't be shared due to security reasons

Testing

To test the application you can use the postman collection provided

Dev environment

It has been created a spring profile so devs don't need to worry about a real firebase token to authenticate requests. In order to use this feature run the application adding

--spring.profiles.active=fake-token-granter

The values that can be used as the tokenId are described in the file application-fake-token-granter.yml

Use those tokens for the parameter firebase_token_id during login to the endpoint oauth/token

technovationslp-backend's People

Contributors

k2rosvall avatar karenmtz3 avatar iuresti avatar

Watchers

James Cloos avatar

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.