Comments (2)
Closing this as a duplicate of gh-790.
If an application needs to override the default 30min expiry for an ID Token, you can use an OAuth2TokenCustomizer to override the default.
from spring-authorization-server.
Just for documentation, so other peoples have the code ready to fix this problem, here how i fix this issue.
this line did the fix
context.getClaims().claim("exp", Instant.now().plus(14, HOURS));
@Bean
public OAuth2TokenCustomizer<JwtEncodingContext> tokenCustomizer() {
return context -> {
var principal = context.getPrincipal();
if (Objects.equals(context.getTokenType().getValue(), "access_token") && principal instanceof UsernamePasswordAuthenticationToken) {
var user = (User) principal.getPrincipal();
context.getClaims().claim("preferred_username", user.getUsername());
context.getClaims().claim(USER_ID_CLAIM_KEY.getKey(), user.getUsername());
context.getClaims().claim("groups", List.of(AZURE_AD_GROUP_AAA_DEV_ADMINPORTAL));
context.getClaims().claim("correlationId", UUID.randomUUID().toString());
}
if (context.getTokenType().getValue().equals(OidcParameterNames.ID_TOKEN)) {
var user = (User) principal.getPrincipal();
context.getClaims()
.claim("preferred_username", user.getUsername());
// Overwrite the exp of the ID TOKEN so the tester can longer test
context.getClaims().claim("exp", Instant.now().plus(14, HOURS));
context.getClaims().claim("groups", List.of(AZURE_AD_GROUP_AAA_DEV_ADMINPORTAL));
}
};
}
from spring-authorization-server.
Related Issues (20)
- Update to Spring Security 6.3.0-M3
- Update to Spring Boot 3.3.0-SNAPSHOT HOT 1
- Update to Spring Framework 6.0.18
- Update to Spring Security 6.1.8
- Update to jackson-bom 2.15.4
- Update to Spring Framework 6.1.5
- Update to Spring Framework 6.1.5
- Update to Spring Security 6.2.3
- Update to jackson-bom 2.16.2
- Update to junit-jupiter 5.10.2
- Update to jackson-bom 2.17.0
- Update to junit-jupiter 5.10.2
- Update to assertj-core 3.25.3
- Update to json-path 2.9.0
- Add proper error handling to `findBy` method in `JdbcOAuth2AuthorizationService ` HOT 3
- JPMS HOT 2
- Inconsistency in reading 'grant_type' values from request. HOT 1
- /oauth2/device_authorization not working HOT 1
- Session created by the OAuth flow should be short lived HOT 5
- RegisteredClient's idTokenSignatureAlgorithm only accepts SignatureAlgorithm HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-authorization-server.