spring-security-oauth2

Jhipster OAuth 2.0 / OIDC Authentication Authorization header with bearer token

风流意气都作罢 提交于 2020-07-07 05:00:30
问题 I’ve used Jhipster to generate an app with the security option OAuth 2.0 / OIDC Authentication. I reconfigured said app to use Okta instead of keycloak following the instructions at http://www.jhipster.tech/security/#okta. All works as expected and the login flow performs as expected. I now want to use OAuth 2.0 access_tokens to access my api resources from additional clients (Postman, Wordpress). I’ve retrieved a valid token from Okta added it to my Postman get request for localhost:8080/api

How to extract claims from Spring Security OAuht2 Boot in the Resource Server?

╄→尐↘猪︶ㄣ 提交于 2020-07-06 04:19:01
问题 I have an Authorization Server built in .Net Core Using Identity Server 4! It is working as expected to authorize clients and resources from Node Js and .Net. Now I'm trying to add a Java spring Boot 2 API (jdk 1.8) as a Protected Resource. I have achieved that goal by using the OAuth2 Boot Documentation! Everything works fine so far. Now, I need to extract the claims from the access token generated by the Authorization Server. This is a Bearer Token of Type JWT. The implementation I have for

How to extract claims from Spring Security OAuht2 Boot in the Resource Server?

雨燕双飞 提交于 2020-07-06 04:18:34
问题 I have an Authorization Server built in .Net Core Using Identity Server 4! It is working as expected to authorize clients and resources from Node Js and .Net. Now I'm trying to add a Java spring Boot 2 API (jdk 1.8) as a Protected Resource. I have achieved that goal by using the OAuth2 Boot Documentation! Everything works fine so far. Now, I need to extract the claims from the access token generated by the Authorization Server. This is a Bearer Token of Type JWT. The implementation I have for

Change the Bad credentials error response spring security oauth2

早过忘川 提交于 2020-06-29 07:23:35
问题 I have a AuthorizationServer which uses password grant_type using spring security. I am using this for mobile application, when a user enter username password to log in, the app calls the token endpoint and generate a token if he/she is an authenticated user. This is all handled by password grant_type itself. For a unsuccessful log in it returns below general error with 400 HTTP status code. { "error": "invalid_grant", "error_description": "Bad credentials" } But for my scenario I need

Intermediate authorization_request_not_found error with Spring Cloud Gateway and Keycloak

这一生的挚爱 提交于 2020-06-29 03:33:56
问题 I am working on a microservice architecture developed in Spring boot with an API gateway service using Spring Cloud Gateway. I am using Keycloak as an identity provider. Everything is working fine normally, but I am getting intermediate authorization_request_not_found exception on user login and a whitelable error page occurs. If we try again, it works. Below is the exception I received on Keycloak server: [org.keycloak.broker.oidc.AbstractOAuth2IdentityProvider] (default task-264) Failed to

Spring Boot, Security OAuth2 Google Logout and no Autologin

浪尽此生 提交于 2020-06-28 03:55:38
问题 My configuration is: @Configuration @EnableWebSecurity(debug = false) @EnableGlobalMethodSecurity(securedEnabled = true) public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private SaveNewOidcUserService saveNewOidcUserService; @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .anyRequest().authenticated() .and() .logout() .clearAuthentication(true) .invalidateHttpSession(true) .deleteCookies("JSESSIONID") .logoutUrl("

How to persist OAuth2AuthorizedClient in redis-session

牧云@^-^@ 提交于 2020-05-31 04:05:50
问题 My project uses redis session with springboot session and spring security 5.1.10 . I just migrated the old oauth2 implementation. Before, when I restarted the app I still had the access_token and refresh_token. With this implementation the user is logged in, but I loose the AuthorizedClients so loadAuthorizedClient function returns null after restarting. Also in production we have many containers with the same app. Is there any springboot stardard way to achieve this? like register some bean

How to persist OAuth2AuthorizedClient in redis-session

二次信任 提交于 2020-05-31 04:05:41
问题 My project uses redis session with springboot session and spring security 5.1.10 . I just migrated the old oauth2 implementation. Before, when I restarted the app I still had the access_token and refresh_token. With this implementation the user is logged in, but I loose the AuthorizedClients so loadAuthorizedClient function returns null after restarting. Also in production we have many containers with the same app. Is there any springboot stardard way to achieve this? like register some bean

Replace Spring Security Login with OTP Verification

让人想犯罪 __ 提交于 2020-05-16 01:40:07
问题 I have a following tables User table -username -password -mobile OTP -mobile -otpCode -expiry WebSecurityConfig http.authorizeRequests().anyRequest().hasAnyRole("ADMIN", "USER") .and() .authorizeRequests().antMatchers("/login**").permitAll() .and() .formLogin().loginPage("/login").loginProcessingUrl("/loginAction").permitAll() .and() .logout().logoutSuccessUrl("/login").permitAll() .and() .csrf().disable(); When I attempt login. Spring Security checks User table for username and password . My

Replace Spring Security Login with OTP Verification

社会主义新天地 提交于 2020-05-16 01:36:10
问题 I have a following tables User table -username -password -mobile OTP -mobile -otpCode -expiry WebSecurityConfig http.authorizeRequests().anyRequest().hasAnyRole("ADMIN", "USER") .and() .authorizeRequests().antMatchers("/login**").permitAll() .and() .formLogin().loginPage("/login").loginProcessingUrl("/loginAction").permitAll() .and() .logout().logoutSuccessUrl("/login").permitAll() .and() .csrf().disable(); When I attempt login. Spring Security checks User table for username and password . My