All Projects → zalando → Tokens

zalando / Tokens

Licence: apache-2.0
Java library for conveniently verifying and storing OAuth 2.0 service access tokens

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Tokens

Spring Boot Oauth2 Jwt Swagger Ui
Spring Boot , OAuth 2 , JWT (Json Web Token) and Swagger UI
Stars: ✭ 77 (-45.77%)
Mutual labels:  authentication, oauth2
Securelogin
This version won't be maintained!
Stars: ✭ 1,259 (+786.62%)
Mutual labels:  authentication, oauth2
Oauth2 Oidc Debugger
An OAuth2 and OpenID Connect Debugger
Stars: ✭ 78 (-45.07%)
Mutual labels:  authentication, oauth2
Salte Auth
💻🗝 Authentication for the modern web!
Stars: ✭ 61 (-57.04%)
Mutual labels:  authentication, oauth2
Auth
Authenticator via oauth2
Stars: ✭ 118 (-16.9%)
Mutual labels:  authentication, oauth2
Geheimtur
a secret door to your Pedestal application
Stars: ✭ 74 (-47.89%)
Mutual labels:  authentication, oauth2
Cierge
🗝️ Passwordless OIDC authentication done right
Stars: ✭ 1,245 (+776.76%)
Mutual labels:  authentication, oauth2
Silhouette
Silhouette is a framework agnostic authentication library for Scala that supports several authentication methods, including OAuth2, OpenID Connect, Credentials, Basic Authentication or custom authentication schemes.
Stars: ✭ 18 (-87.32%)
Mutual labels:  authentication, oauth2
Vue Authenticate
Simple Vue.js authentication library
Stars: ✭ 1,350 (+850.7%)
Mutual labels:  authentication, oauth2
Ngx Api Utils
ngx-api-utils is a lean library of utilities and helpers to quickly integrate any HTTP API (REST, Ajax, and any other) with Angular.
Stars: ✭ 92 (-35.21%)
Mutual labels:  authentication, oauth2
Visa
Easy third party authentication (OAuth 2.0) for Flutter apps.
Stars: ✭ 50 (-64.79%)
Mutual labels:  authentication, oauth2
Fosite
Extensible security first OAuth 2.0 and OpenID Connect SDK for Go.
Stars: ✭ 1,738 (+1123.94%)
Mutual labels:  authentication, oauth2
Flask Httpauth
Simple extension that provides Basic, Digest and Token HTTP authentication for Flask routes
Stars: ✭ 951 (+569.72%)
Mutual labels:  authentication, tokens
Cas
Apereo CAS - Enterprise Single Sign On for all earthlings and beyond.
Stars: ✭ 9,154 (+6346.48%)
Mutual labels:  authentication, oauth2
Oauth2
OAuth2 client in Go
Stars: ✭ 20 (-85.92%)
Mutual labels:  authentication, oauth2
Vouch Proxy
an SSO and OAuth / OIDC login solution for Nginx using the auth_request module
Stars: ✭ 1,239 (+772.54%)
Mutual labels:  authentication, oauth2
Play Silhouette
Silhouette is an authentication library for Play Framework applications that supports several authentication methods, including OAuth1, OAuth2, OpenID, CAS, 2FA, TOTP, Credentials, Basic Authentication or custom authentication schemes.
Stars: ✭ 826 (+481.69%)
Mutual labels:  authentication, oauth2
Jso
Easy to use OAuth 2.0 javascript library for use in your javascript application.
Stars: ✭ 830 (+484.51%)
Mutual labels:  authentication, oauth2
Ueberauth
An Elixir Authentication System for Plug-based Web Applications
Stars: ✭ 1,259 (+786.62%)
Mutual labels:  authentication, oauth2
Aura.auth
Provides a unified interface to local and remote authentication systems.
Stars: ✭ 121 (-14.79%)
Mutual labels:  authentication, oauth2

Tokens

Tokens is a Java library for verifying and storing OAuth 2.0 service access tokens. It is resilient, configurable, and production-tested, and works with all JVM languages.

Build Status Javadocs Maven Central Coverage Status codecov.io

Project Features and Functionality

Some of the features Tokens offers:

  • support for credential rotation, by reading them on-demand from the file system
  • extensiblity with a credentials provider
  • configuration flexibility; specify multiple tokens with different scopes
  • the ability to inject fixed OAuth2 access tokens

Tokens can be useful to devs (at any company, large or small) who are working with highly-distributed microservices deployed in the cloud and need to authenticate the traffic generated when accessing APIs. For example, if your team wants to consume an API with OAuth2 credentials, Tokens will fetch the tokens for you. Then you just add scopes in the token.

When creating tokens, it's easy to make a lot of mistakes. Tokens aims to save you hassle and time.

Prerequisites

  • Java 8
  • Maven
  • Gradle

Maven Dependency

Add it with:

<dependency>
    <groupId>org.zalando.stups</groupId>
    <artifactId>tokens</artifactId>
    <version>see above</version>
</dependency>

Gradle Dependency

compile('org.zalando.stups:tokens:${version}')

Usage in Zalandos K8s environment (with PlatformCredentialsSet)

It uses /meta/credentials as a default folder to look for provided tokens by PlatformCredentialsSet.

import org.zalando.stups.tokens.Tokens;
import org.zalando.stups.tokens.AccessTokens;

AccessTokens tokens = Tokens.createAccessTokensWithUri(new URI("https://this.url.will.be.ignored"))
                            .start();

while (true) {
    final String token = tokens.get("exampleRO");

    Request.Get("https://api.example.com")
           .addHeader("Authorization", "Bearer " + token)
           .execute():

    Thread.sleep(1000);
}

Want to migrate from STUPS to K8s? See the hints.

Usage in Zalandos STUPS environment

import org.zalando.stups.tokens.Tokens;
import org.zalando.stups.tokens.AccessTokens;

AccessTokens tokens = Tokens.createAccessTokensWithUri(new URI("https://example.com/access_tokens"))
                            .manageToken("exampleRW")
                                .addScope("read")
                                .addScope("write")
                                .done()
                            .manageToken("exampleRO")
                                .addScope("read")
                                .done()
                            .start();

while (true) {
    final String token = tokens.get("exampleRO");

    Request.Get("https://api.example.com")
           .addHeader("Authorization", "Bearer " + token)
           .execute():

    Thread.sleep(1000);
}

Migration from Zalandos STUPS env to Zalandos K8s env

Your code can stay as is.

A common issue is not mounting the credentials. Please use the example below as a guide line.

...
          volumeMounts:
          - name: "{{ APPLICATION }}-credentials"
            mountPath: /meta/credentials
            readOnly: true
      volumes:
        - name: "{{ APPLICATION }}-credentials"
          secret:
            secretName: "{{ APPLICATION }}-credentials"

Please also make sure that token identifiers/names must equal the respective items in credentials.yaml::

apiVersion: "zalando.org/v1"
kind: PlatformCredentialsSet
metadata:
   name: "{{ APPLICATION }}-credentials"
spec:
   application: "{{ APPLICATION }}"
   tokens:
     exampleRW:
       privileges:
         - com.zalando::read
         - com.zalando::write
     exampleRO:
       privileges:
         - com.zalando::read

Local Testing

With Tokens, you can inject fixed OAuth2 access tokens via the OAUTH2_ACCESS_TOKENS environment variable and test applications locally with personal OAuth2 tokens. As an example:

$ MY_TOKEN_1=$(zign token -n mytok1)
$ MY_TOKEN_2=$(zign token -n mytok2)
$ export OAUTH2_ACCESS_TOKENS=mytok1=$MY_TOKEN_1,mytok2=$MY_TOKEN_2
$ lein repl # start my local Clojure app using the tokens library

In production on EC2 instances, Tokens fetches access tokens by requesting an authorization server with credentials, found in client.json and user.json. It's also possible to provide client.json and user.json with valid content and point this library to that directory.

Contributing

This project welcomes contributions, including bug fixes and documentation enhancements. To contribute, please use the Issues Tracker to let us know what you would like to do. We'll respond, and go from there.

License

Copyright © 2015 Zalando SE

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].