Skip to content

Instantly share code, notes, and snippets.

View italogustavoborba's full-sized avatar
💭
🏠 Working from home

Ítalo Teixeira italogustavoborba

💭
🏠 Working from home
View GitHub Profile
// this is based on code from https://www.baeldung.com/spring-security-oauth-jwt
// also based on code from https://connect2id.com/products/nimbus-jose-jwt/examples/signed-and-encrypted-jwt and https://connect2id.com/products/nimbus-jose-jwt/examples/jwt-with-rsa-encryption
// used com.nimbusds:nimbus-jose-jwt:6.4.2
// interesting bits at lines 120 - 188
/**
* THIS IS JUST A PROOF OF CONCEPT. DO NOT USE IN PRODUCTION.
*/
import java.text.ParseException;
import java.util.Arrays;
@italogustavoborba
italogustavoborba / AuthorizationServerConfig.java
Created August 8, 2021 03:03 — forked from thiagofa/AuthorizationServerConfig.java
Suporte a PKCE com Authorization Code no Spring Security OAuth2
// Parte da configuração do Authorization Server, para adicionar o TokenGranter customizado
@Configuration
@EnableAuthorizationServer
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) {
endpoints.tokenGranter(tokenGranter(endpoints));
}
@italogustavoborba
italogustavoborba / -Spring-JPA-Dynamic-Query-With-Limit
Created April 5, 2020 20:18 — forked from tcollins/-Spring-JPA-Dynamic-Query-With-Limit
Spring Data JPA - Limit results when using Specifications without an unnecessary count query being executed
If you use the findAll(Specification, Pageable) method, a count query is first executed and then the
data query is executed if the count returns a value greater than the offset.
For what I was doing I did not need pageable, but simply wanted to limit my results. This is easy
to do with static named queries and methodNameMagicGoodness queries, but from my research (googling
for a few hours) I couldn't find a way to do it with dynamic criteria queries using Specifications.
During my search I found two things that helped me to figure out how to just do it myself.
1.) A stackoverflow question.
@italogustavoborba
italogustavoborba / Tutorial4_RFRemoteReplay.ino
Created January 18, 2020 02:08 — forked from ArduinoBasics/Tutorial4_RFRemoteReplay.ino
Use Arduino to receive and transmit RF Remote signal
/*
433 MHz RF REMOTE REPLAY sketch
Written by ScottC 24 Jul 2014
Arduino IDE version 1.0.5
Website: http://arduinobasics.blogspot.com.au/2014/07/433-mhz-rf-module-with-arduino-tutorial_30.html
Receiver: XY-MK-5V Transmitter: FS1000A/XY-FST
Description: Use Arduino to receive and transmit RF Remote signal
------------------------------------------------------------- */
#define rfReceivePin A0 //RF Receiver data pin = Analog pin 0
/*
TITLE: CODE GRABBER FOR HT6P20B ENCODER
CREATED BY: AFONSO CELSO TURCATO
DATE: 14/JAN/2014
E-MAIL: acturcato (at) gmail.com
LICENSE: GPL
REV.: 00
DESCRIÇÃO:
http://acturcato.wordpress.com/2014/01/14/clonagem-de-controle-remoto-rf-learning-code-ht6p20b-com-arduino/