Code Monkey home page Code Monkey logo

stroom-auth's Introduction

stroom-auth

Pre-release version of a Stroom authentication service.

Releasing to DockerHub

You can release an image to DockerHub by pushing a tag to GitHub. GitHub will tell Travis to build, and pass it the tag. Our CI build script, travis.script.sh, will do the build and push the image. It will do this for every push to master and it will do it for certain tags.

There are two images built in this repo: one for the service and one for the UI. These have separate release cycles, so one could be on v1.0-beta.1 and one could be on v1.0-beta.5. This complicates the build slightly. If you want to release a tagged version you need to add a prefix to the tag, so Travis can detect whether it's for the UI or for the service. This prefix has to be in the right format to work. The formats are:

  • For a UI build prefix the tag with ui_, e.g. ui_v1.0-beta.6.
  • For a service build prefix the tag with service_, e.g. service_v1.0-beta.7.

Travis will strip the prefix when it builds the docker image. The end result is that DockerHub has sensible tags, e.g. gchq/stroom-auth-ui:v1.0-beta.5 instead of gchq/stroom-auth-ui:ui_v1.0-beta.5. GitHub will retain the tag you pushed, i.e. the one with the prefix.

stroom-auth-svc

A service that accepts HTTP requests for authentication, and returns JWS tokens.

Usage

You can interrogate the service using HTTPie.

Getting a JWS token

You can use this token to make requests to secured endpoints. The default email and password is admin:admin.

$ http POST localhost:8099/authentication/login email=admin password=admin 

Getting all users

In the below you'd have to paste your JWS token.

The following would get all users, with 10 per page.

$ http GET 'http://localhost:8099/user/?fromEmail=&usersPerPage=10&orderBy=id' Authorization:"Bearer <TOKEN>"

The following would get users from testUser, with 10 per page.

$ http GET 'http://localhost:8099/user/?fromEmail=testUser&usersPerPage=2&orderBy=id' Authorization:"Bearer <TOKEN>"

stroom-persistence

This module accesses the existing Stroom database. Eventually the relevant tables will be migrated to a service. But until then we'll access them in this fashion, using JOOQ.

Making a database change in dev

Obviously you'll lose test data if you do this.

  1. Stop the database container and delete it
  2. Change the migrations to whatever SQL you need
  3. Run the app to perform the migrations (or use the Flyway command line)
  4. Delete the old models at stroom-persistence/src/main/java/stroom.
  5. Run ./gradlew generateAuthdbJooqSchemaSource to generate the models again
  6. Restart app

Dropping all tables

DROP TABLE json_web_key;
DROP TABLE tokens;
DROP TABLE users;
DROP TABLE token_types;
DROP TABLE schema_version;

Getting a summary of tokens

SELECT t.id, tt.token_type, u.email, t.expires_on, t.comments 
FROM token_types AS tt, users AS u, tokens AS t 
WHERE tt.id=t.token_type_id AND u.id=t.user_id; 

stroom-auth's People

Contributors

at055612 avatar jc064522 avatar stroomdev66 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.