Skip to content

Instantly share code, notes, and snippets.

View jeffersonchaves's full-sized avatar
😎
Focusing

Jefferson Chaves jeffersonchaves

😎
Focusing
  • Instituto Federal do Paraná - IFPR
  • Foz do Iguaçu - PR
View GitHub Profile
@Configuration
@EnableWebSecurity
public class SecurityConfig {
@Value("${jwt.public.key}")
RSAPublicKey publicKey;
@Value("${jwt.private.key}")
RSAPrivateKey privateKey;
@Service
public class JwtService {
@Autowired
private JwtEncoder encoder;
public String generateToken(Authentication authentication) {
Instant now = Instant.now();
long expiry = 525600L;
@Service
public class UserDetailService implements UserDetailsService {
@Autowired
UserRepository userRepository;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
public class UserAuthenticated implements UserDetails{
User user;
public UserAuthenticated(User user) {
this.user = user;
}
@Override
@Repository
public interface UserRepository extends JpaRepository<User, Long> {
public Optional<User> findByUsername(String username);
}
@Entity
@Data
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String username;
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>
programa
{
real total = 0.0
funcao inicio()
{
inteiro opcao = -1
menu()
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="container">
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Ubuntu", sans-serif;