All Projects → GildedHonour → Frank_jwt

GildedHonour / Frank_jwt

Licence: apache-2.0
JSON Web Token implementation in Rust.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Frank jwt

Awesome Iam
👤 Identity and Access Management Knowledge for Cloud Platforms
Stars: ✭ 186 (-18.06%)
Mutual labels:  authentication, jwt, cryptography
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 (-59.47%)
Mutual labels:  authentication, jwt, jwt-token
Lock.swift
A Swift & iOS framework to authenticate using Auth0 and with a Native Look & Feel
Stars: ✭ 215 (-5.29%)
Mutual labels:  authentication, jwt
Jwtpermission
基于token验证的Java Web权限控制框架,使用jjwt,支持redis和db多种存储方式,可用于前后端分离项目,功能完善、使用简单、易于扩展。
Stars: ✭ 186 (-18.06%)
Mutual labels:  jwt, jwt-token
Authentic
Authentication for microservices.
Stars: ✭ 221 (-2.64%)
Mutual labels:  authentication, jwt
Apigatewaydemo
🌱 Simple samples that use Ocelot to build API Gateway.
Stars: ✭ 217 (-4.41%)
Mutual labels:  authentication, jwt
Pac4j
Security engine for Java (authentication, authorization, multi frameworks): OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 2,097 (+823.79%)
Mutual labels:  authentication, jwt
Nextjs Jwt Authentication
A proof of concept app for demonstrating authentication of Next.js app with JWT.
Stars: ✭ 191 (-15.86%)
Mutual labels:  authentication, jwt
Spark Pac4j
Security library for Sparkjava: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 154 (-32.16%)
Mutual labels:  authentication, jwt
Firebase Esp32
ESP32 Firebase RTDB Arduino Library
Stars: ✭ 204 (-10.13%)
Mutual labels:  jwt, jwt-token
Express Graphql Boilerplate
Express GraphQL API with JWT Authentication and support for sqlite, mysql, and postgresql
Stars: ✭ 201 (-11.45%)
Mutual labels:  authentication, jwt
Jwt Spring Security Jpa
Backend MVP showcasing JWT (Json Web Token) authentication with multiple login, timeout / refresh / logout (with in memory invalidation) using Spring Security & MySQL JPA.
Stars: ✭ 202 (-11.01%)
Mutual labels:  jwt, jwt-token
Cognito Express
Authenticates API requests on a Node application by verifying the JWT signature of AccessToken or IDToken generated by Amazon Cognito.
Stars: ✭ 165 (-27.31%)
Mutual labels:  authentication, jwt
Security.identity
.NET DevPack Identity is a set of common implementations to help you implementing Identity, Jwt, claims validation and another facilities
Stars: ✭ 165 (-27.31%)
Mutual labels:  authentication, jwt
Doorkeeper Jwt
JWT Token support for Doorkeeper
Stars: ✭ 174 (-23.35%)
Mutual labels:  jwt, jwt-token
Api guard
JWT authentication solution for Rails APIs
Stars: ✭ 159 (-29.96%)
Mutual labels:  authentication, jwt
Sanic Jwt
Authentication, JWT, and permission scoping for Sanic
Stars: ✭ 189 (-16.74%)
Mutual labels:  authentication, jwt
Rodauth Rails
Rails integration for Rodauth authentication framework
Stars: ✭ 150 (-33.92%)
Mutual labels:  authentication, jwt
Express Mongodb Rest Api Boilerplate
A boilerplate for Node.js apps / Rest API / Authentication from scratch - express, mongodb (mongoose).
Stars: ✭ 153 (-32.6%)
Mutual labels:  authentication, jwt
Apns2
⚡ HTTP/2 Apple Push Notification Service (APNs) push provider for Go — Send push notifications to iOS, tvOS, Safari and OSX apps, using the APNs HTTP/2 protocol.
Stars: ✭ 2,569 (+1031.72%)
Mutual labels:  jwt, jwt-token

Frank JWT Build Status crates.io

Implementation of JSON Web Tokens in Rust.

Algorithms and features supported

  • [x] HS256
  • [x] HS384
  • [x] HS512
  • [x] RS256
  • [x] RS384
  • [x] RS512
  • [x] ES256
  • [x] ES384
  • [x] ES512
  • [x] Sign
  • [x] Verify
  • [ ] iss (issuer) check
  • [ ] sub (subject) check
  • [ ] aud (audience) check
  • [x] exp (expiration time) check
  • [ ] nbf (not before time) check
  • [ ] iat (issued at) check
  • [ ] jti (JWT id) check

Usage

Put this into your Cargo.toml:

[dependencies]
frank_jwt = "<current version of frank_jwt>"

And this in your crate root:

extern crate frank_jwt;
#[macro_use] extern crate serde_json;


use frank_jwt::{Algorithm, encode, decode};

Example

//HS256
let mut payload = json!({
    "key1": "val1",
    "key2": "val2"
});

let mut header = json!({});
let secret = "secret123";
let jwt = encode(&header, secret.to_string(), &payload, Algorithm::HS256);

//RS256
use std::env;

let mut payload = json!({
    "key1": "val1",
    "key2": "val2"
});

let mut header = json!({});
let mut keypath = env::current_dir().unwrap();
keypath.push("some_folder");
keypath.push("my_rsa_2048_key.pem");
let jwt = encode(&header, &keypath.to_path_buf(), &payload, Algorithm::RS256);
let (header, payload) = decode(&jwt, &keypath.to_path_buf(), Algorithm::RS256, &ValidationOptions::default());

Validation Options

The ValidationOptions structure allows for control over which checks should be preformed when decoding a JWT. Calling new on this will provide a default set of values. There is also a dangerous function that will return validation options that doesn't perform any checking.

The default values are:

  • Perform expiry check
  • Allow 0 leeway for the expiry check.

It's worth noting that if the expiry check is requested and an exp claim is not within the JWT the check will fail validation.

License

Apache 2.0

Tests

cargo test

Contributors

TODO

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].