All Projects → IxorTalk → Ixortalk.aws.cognito.jwt.security.filter

IxorTalk / Ixortalk.aws.cognito.jwt.security.filter

Licence: mit
Spring Boot security filter for decoding Cognito JWT IdTokens

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Ixortalk.aws.cognito.jwt.security.filter

Oidc Workshop Spring Io 2019
Workshop at Spring I/O 2019 on "Securing Microservices with OpenID Connect and Spring Security 5.1"
Stars: ✭ 43 (-42.67%)
Mutual labels:  spring-boot, jwt, spring-security
Xboot
基于Spring Boot 2.x的一站式前后端分离快速开发平台XBoot 微信小程序+Uniapp 前端:Vue+iView Admin 后端:Spring Boot 2.x/Spring Security/JWT/JPA+Mybatis-Plus/Redis/Elasticsearch/Activiti 分布式限流/同步锁/验证码/SnowFlake雪花算法ID 动态权限 数据权限 工作流 代码生成 定时任务 社交账号 短信登录 单点登录 OAuth2开放平台 客服机器人 数据大屏 暗黑模式
Stars: ✭ 3,432 (+4476%)
Mutual labels:  spring-boot, jwt, spring-security
Angular Spring Starter
Full stack starter kit featuring Angular 7, Spring boot and stateless JWT authentication.
Stars: ✭ 294 (+292%)
Mutual labels:  spring-boot, jwt, spring-security
Cognito Express
Authenticates API requests on a Node application by verifying the JWT signature of AccessToken or IDToken generated by Amazon Cognito.
Stars: ✭ 165 (+120%)
Mutual labels:  aws, jwt, cognito
Cerberus
A demonstration of a completely stateless and RESTful token-based authorization system using JSON Web Tokens (JWT) and Spring Security.
Stars: ✭ 482 (+542.67%)
Mutual labels:  spring-boot, jwt, spring-security
Jwt Spring Security Demo
This is a demo for using JWT (JSON Web Token) with Spring Security and Spring Boot. I completely rewrote my first version. Now this solution is based on the code base from the JHipster Project. I tried to extract the minimal configuration and classes that are needed for JWT-Authentication and did some changes.
Stars: ✭ 2,843 (+3690.67%)
Mutual labels:  spring-boot, jwt, spring-security
Eshop Soa
EShop基于Dubbo实现SOA服务化拆分,并基于RocketMQ解决了分布式事务(新版SpringBootSOASkeleton)
Stars: ✭ 65 (-13.33%)
Mutual labels:  spring-boot, jwt, spring-security
Spring Reddit Clone
Reddit clone built using Spring Boot, Spring Security with JPA Authentication, Spring Data JPA with MySQL, Spring MVC. The frontend is built using Angular - You can find the frontend source code here - https://github.com/SaiUpadhyayula/angular-reddit-clone
Stars: ✭ 210 (+180%)
Mutual labels:  spring-boot, jwt, spring-security
Spring Boot Webflux Jjwt
Example Spring Boot and WebFlux (Reactive Web) with Spring Security and JWT for token Authentication and Authorization
Stars: ✭ 71 (-5.33%)
Mutual labels:  spring-boot, jwt, spring-security
Spring Boot In Action
Spring Boot 系列实战合集
Stars: ✭ 4,153 (+5437.33%)
Mutual labels:  spring-boot, jwt, spring-security
Deploy Spring Boot Aws Eb
Deploying Spring Boot Apps to AWS using Elastic Beanstalk
Stars: ✭ 79 (+5.33%)
Mutual labels:  aws, spring-boot, spring-security
Simplemall
基于SpringCloud的微服务架构实战案例项目,以一个简单的购物流程为示例,融合spring cloud 相关组件,如spring-cloud-netflix、swagger等
Stars: ✭ 687 (+816%)
Mutual labels:  spring-boot, jwt, spring-security
Eladmin
项目基于 Spring Boot 2.1.0 、 Jpa、 Spring Security、redis、Vue的前后端分离的后台管理系统,项目采用分模块开发方式, 权限控制采用 RBAC,支持数据字典与数据权限管理,支持一键生成前后端代码,支持动态路由
Stars: ✭ 16,943 (+22490.67%)
Mutual labels:  spring-boot, jwt, spring-security
Blog Tutorials
⭐️ Codebase for the tutorials on my blog about Java, Spring Boot, AWS, Kotlin and Testing
Stars: ✭ 257 (+242.67%)
Mutual labels:  aws, spring-boot, spring-security
Spring Security Pac4j
pac4j security library for Spring Security: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 231 (+208%)
Mutual labels:  spring-boot, jwt, spring-security
Spring Webmvc Jwt Sample
Secures REST APIs with Spring Security and JWT Token based Authentication
Stars: ✭ 299 (+298.67%)
Mutual labels:  spring-boot, jwt, spring-security
Jwt Security Example
Spring Boot with Spring Security using JWT
Stars: ✭ 154 (+105.33%)
Mutual labels:  spring-boot, jwt, spring-security
Spring Webflux Security Jwt
A JWT authorization and authentication implementation with Spring Reactive Webflux, Spring Boot 2 and Spring Security 5
Stars: ✭ 190 (+153.33%)
Mutual labels:  spring-boot, jwt, spring-security
His
HIS英文全称 hospital information system(医院信息系统http://59.110.234.89:9999/swagger-ui.html ),医疗信息就诊系统,系统主要功能按照数据流量、流向及处理过程分为临床诊疗、药品管理、财务管理、患者管理。诊疗活动由各工作站配合完成,并将临床信息进行整理、处理、汇总、统计、分析等。本系统包括以下工作站:门诊医生工作站、药房医生工作站、医技医生工作站、收费员工作站、对帐员工作站、管理员工作站。需求为东软提供的云医院。
Stars: ✭ 359 (+378.67%)
Mutual labels:  spring-boot, jwt, spring-security
Springboot Jwt Starter
A Spring Boot JWT starter kit for stateless and token-based authentication apps.
Stars: ✭ 538 (+617.33%)
Mutual labels:  spring-boot, jwt, spring-security

Introduction

This Spring Boot auto configuration module offers a security filter, capable of

  • Decoding an AWS Cognito JWT idToken
  • Verifying the JWT token signature
  • Verifying the JWT token issuer
  • Creating a principal object using the username contained in the JWT token
  • Convert the associated cognito groups into SimpleGrantedAuthorities

This modules aim to bridge the gap between Cognito identities and Spring Boot Security Principals.

Usage

Maven Dependency

The module is made available via Maven Central and is currently at version 0.0.6. It can be added to your Maven based project like this :

<dependency>
    <groupId>com.ixortalk</groupId>
    <artifactId>ixortalk.aws.cognito.jwt.security.filter</artifactId>
    <version>0.0.7</version>
</dependency> 

or when using Gradle :

compile 'com.ixortalk:ixortalk.aws.cognito.jwt.security.filter:0.0.7'

Security Configuration class

Create a security configuration, inject the AwsCognitoJwtAuthenticationFilter and add it to the filterchain.

@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter implements Ordered {

	private int order = 4;

	@Autowired
	private AwsCognitoJwtAuthenticationFilter awsCognitoJwtAuthenticationFilter;

	@Override
	public int getOrder() {
		return order;
	}

	public void setOrder(int order) {
		this.order = order;
	}

	@Override
	protected void configure(HttpSecurity http) throws Exception {

		http.headers().cacheControl();
		http.csrf().disable()
				.authorizeRequests()
				.antMatchers("/health").permitAll()
				.antMatchers("/v2/**").permitAll()
				.antMatchers("/docs/**").permitAll()
				.antMatchers("/api/**").authenticated()
				.antMatchers("/**").permitAll() // needs to be the last matcher, otherwise all matchers following it would never be reached
				.anyRequest().authenticated()
				.and()
				.addFilterBefore(awsCognitoJwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
	}

}

This will add a security filter to your spring boot app that will look for a JWT idToken in the Authorization header of the request.

Security Configuration Properties

In order to be able to verify and decode JWT Tokens, the module needs some Cognito configuration. This includes

  • userPoolId
  • identityPoolId
  • region

Add the following configuration to your application to give the verifier sufficient information to decode the JWT token:

com:
  ixortalk:
    security:
        jwt:
          aws:
            userPoolId: "us-west-2_abcdefghi"
            identityPoolId: "us-west-2:xxxxxxxx-aaaa-bbbb-ccc-dddddddddddd"
            region: "us-west-2"

HTTP call

To call a secure endpoint with a JWT token, add the authorization header with the Bearer type, followed by the actual token.

curl -v -H "Authorization: Bearer $TOKEN" http://localhost:8080/api/secure | jq

License

The MIT License (MIT)

Copyright (c) 2016-present IxorTalk CVBA

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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