Projeto Base - Spring Security - Blog Pessoal

Overview

Implementando a Camada de Segurança com o Spring Security no Blog Pessoal

Nesta atividade iremos implementar a camada de segurança da aplicação com o Spring Security.

Boas Práticas

  • Configure as Dependências no arquivo pom.xml
    • spring-boot-starter-security
    • commons-codec
  • Configure o Banco de Dados
  • Crie a Classe Usuario na Camada Model
    • Crie o Relacionamento (One to Many) com a Classe Postagem
    • Crie os Métodos Get e Set
  • Crie o Relacionamento (Many to one) entre as Classes Postagem e Usuario na Classe Postagem na Camada Model
  • Crie a Classe UsuarioLogin na Camada Model
    • Crie os Métodos Get e Set
  • Crie a Classe UsuarioRepository Camada Repository
    • Crie o Método findByUsuario()
  • Crie a Classe UsuarioController na Camada Controller
    • Crie o Método Login
    • Crie o Método Post
    • Crie o Método Put
    • Crie o Método GetAll
    • Crie o Método GetById()
  • Crie a classe BasicSecurityConfig na Camada Security
  • Crie a classe UserDetailsImpl na Camada Security
  • Crie a classe UserDetailsService na Camada Security
  • Crie a classe UsuarioService na Camada Service
    • Crie o Método Login
    • Crie o Método Post
    • Crie o Método Put
  • Execute os testes no Postman
    • Cadastrar Usuário
    • Logar com o Usuário para receber o Token
    • Inserir o Token no Cabeçalho de todos os métodos antes de testar

Referências

Documentação Oficial do Spring Security

Página Oficial do JWT

Dependência commons-codec

You might also like...

Rate limiting private REST APIs using Java Spring-boot, spring-security and bucket4j

Rate limiting REST APIs using Spring-security filter and Bucket4J Deployed Application (Swagger-ui on heroku) Inspired from: Baeldung Article Applicat

Jul 18, 2022

Zitadel.ch Example Project with Spring Boot and Spring Security

Zitadel.ch Example Project with Spring Boot and Spring Security

Zitadel Example Project with Spring Boot and Spring Security This example contains two Spring Boot Apps (app and api) which use the Zitadel IdP as Ope

May 3, 2022

Java based open source static site/blog generator for developers & designers.

JBake JBake is a Java based open source static site/blog generator for developers. Documentation Full documentation is available on jbake.org. Contrib

Dec 30, 2022

🦄 Best beautiful java blog, worth a try

🦄 Best beautiful java blog, worth a try

Tale Blog Tale's English meaning for the Story, I believe that every person who insists on writing a blog is a story; Chinese you call it Collapse doe

Dec 30, 2022

A blog recipes API for you to share and search for food recipes

A blog recipes API for you to share and search for food recipes

Apr 15, 2022

A personal blog based on Vue+SpringBoot+MySql+Redis+Shiro+JWT

A personal blog based on Vue+SpringBoot+MySql+Redis+Shiro+JWT

项目:Vue-SpringBoot-PersonalBlog 个人博客网址:http://www.huchao.vip/blogs CSDN:毛_三月 介绍 一个基于SpringBoot + Vue+MybatisPlus+Shiro+JWT+Redis开发的前后端分离博客项目,带有超级详细开发文档

Dec 20, 2022

Projeto desenvolvido durante a Semana Spring React da DevSuperior

Projeto DSVendas Projeto desenvolvido durante a Semana Spring React da DevSuperior 3, ministrado por Nélio Alves. O evento ocorreu entre 03.05.21 à 09

May 8, 2021

Projeto em desenvolvimento durante a Semana Spring React - DevSuperior

Projeto em desenvolvimento durante a Semana Spring React - DevSuperior

Projeto desenvolvido durante a Semana Spring React - DevSuperior Aplicação Web com um Dashboard de Vendas Tecnologias utilizadas: Banco de Dados: Post

Dec 13, 2021

um projeto até q bem feito pra uma primeira vez em java spring

todo-list-java-spring um projeto até q bem feito pra uma primeira vez em java spring boot eu não sei como roda isso e nem como configura se não gostou

Jun 9, 2022
Owner
Rafael Queiróz
Rafael Queiróz
循序渐进,学习Spring Boot、Spring Boot & Shiro、Spring Batch、Spring Cloud、Spring Cloud Alibaba、Spring Security & Spring Security OAuth2,博客Spring系列源码:https://mrbird.cc

Spring 系列教程 该仓库为个人博客https://mrbird.cc中Spring系列源码,包含Spring Boot、Spring Boot & Shiro、Spring Cloud,Spring Boot & Spring Security & Spring Security OAuth2

mrbird 24.8k Jan 6, 2023
Projeto de LAB: Conhendo o projeto Spring data JPA com Java na prática

Conhecendo o Projeto Spring Data JPA na Prática Sejam bem-vindos ao projeto de LAB Conhecendo o Projeto Spring Data JPA na Prática oferecido gratuitam

Camila Cavalcante 130 Dec 31, 2022
参考 DDD/Clean Architecture 设计理念,整合 Spring Boot/Spring Security/Mybatis Plus/Vavr 的 Spring Realworld 应用案例

Demo · 更多项目 · 参考资料 ms-spring-ddd-examples Unified Domain-driven Layered Architecture for MicroService Apps,试图探索一套切实可行的应用架构规范,可以复制、可以理解、可以落地、可以控制复杂性的指导

王下邀月熊 19 Sep 23, 2022
Spring Boot & MongoDB Login and Registration example with JWT, Spring Security, Spring Data MongoDB

Spring Boot Login and Registration example with MongoDB Build a Spring Boot Auth with HttpOnly Cookie, JWT, Spring Security and Spring Data MongoDB. Y

null 15 Dec 30, 2022
Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example

Spring Boot Login example with Spring Security, MySQL and JWT Appropriate Flow for User Login and Registration with JWT Spring Boot Rest Api Architect

null 58 Jan 5, 2023
Spring Boot JWT Authentication example with Spring Security & Spring Data JPA

Spring Boot JWT Authentication example with Spring Security & Spring Data JPA

null 1 Jan 26, 2022
A simple blog post api made with spring,mysql.Following tutorial by @FadatareRamesh(Java Guides)

blogAPI A simple blog post api made with spring,mysql.Following tutorial by @FadatareRamesh(Java Guides) Frontend server(made using Angular) can be fo

null 1 Feb 2, 2022
Spring MVC backend written in Java for my wiki/blog

blog-api Spring MVC backend written in Java for my wiki/blog. Why Spring? Spring MVC and other parts of the Spring framework are still immensely popul

null 0 Mar 16, 2022
Application for creating blog posts, developed with Java using Spring Framework for backend and Angular along with PrimeNG Library for frontend development.

Application for creating blog posts, developed with Java using Spring Framework for backend and Angular along with PrimeNG Library for frontend development.

Áureo Carmelino 10 Nov 27, 2022
Projeto criado na semana Spring React organizado pela escola Dev Superior com foco na prática/aprendizado das tecnologias Spring e React.

DSVendas Projeto criado na semana Spring React organizado pela escola Dev Superior com foco na prática/aprendizado das tecnologias Spring e React. htt

João Gabriel 3 May 18, 2021