Giter VIP home page Giter VIP logo

primer-bundle's Introduction

Dropwizard Primer Bundle Travis build status

This bundle adds Primer JWT service support for dropwizard. This bundle compiles only on Java 8.

Dependencies

Usage

The bundle adds Primer JWT service support for dropwizard. This makes it easier to secure the your API with JWT and a robust claims negotiation. Tokens can be either static (no expiry) or dynamic with expiry. As a added bonus; it supports declarative role based authorizations

Build instructions

  • Clone the source:

    git clone github.com/phaneesh/primer-bundle
    
  • Build

    mvn install
    

Maven Dependency

Use the following repository:

<repository>
    <id>clojars</id>
    <name>Clojars repository</name>
    <url>https://clojars.org/repo</url>
</repository>

Use the following maven dependency:

<dependency>
    <groupId>io.dropwizard.primer</groupId>
    <artifactId>primer-bundle</artifactId>
    <version>2.0.16-1</version>
</dependency>

Using Primer bundle

Bootstrap

    @Override
    public void initialize(final Bootstrap...) {
        bootstrap.addBundle(new PrimerBundle() {
            
            public PrimerBundleConfiguration getPrimerConfiguration() {
                ...
            }
            
            public Set<String> withWhiteList(T configuration) {
                ...
            }
            
            public PrimerAuthorizationMatrix withAuthorization(T configuration) {
                ...
            }
        });
    }

Configuration

primer:
  enabled: true
  authTypesEnabled:
    CONFIG: true
    ANNOTATION: true
  absentTokenStatus: BAD_REQUEST
  endpoint:
    type: simple
    host: my.primer.somewhere
    port: 8080
  cacheExpiry: 600
  cacheMaxSize: 100000
  clockSkew: 60
  prefix: Bearer
  privateKey: thisismynotsosecretkey 
  whileListUrl:
    - unprotected/url
    - unprotected/url/{with}/{path}/{param}
  authorizations:
    - type: dynamic #can be static, dynamic or auto (uses token to infer the type of auth)
      methods:
        - GET
      roles:
        - user
      url: protected/user/{do}/{some}/{stuff}
    - type: static
      methods:
        - POST
      roles:
        - admin
      url: protected/admin/{do}/{admin}/{stuff}  

LICENSE

Copyright 2016 Phaneesh Nagaraja [email protected].

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

primer-bundle's People

Contributors

mudit1403 avatar nitishgoyal13 avatar phaneesh avatar r0goyal avatar santanusinha avatar

Watchers

 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.