spring-security-oauth2

How to set proxy on spring oauth2 OAuth2AccessToken request or How to override OAuth2AccessTokenSupport restTemplate variable?

冷暖自知 提交于 2019-11-29 07:27:26
I have tried to set network proxy in the following ways, but none of the method is working 1: set jvm variables like -Dhttp.proxyHost= -Dhttp.proxyPort= ....... 2: Created the Bean. @Bean public RestTemplate restTemplate() { final String proxyHost = "######"; // host final int proxyPort = ####; // port SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); factory.setProxy(new Proxy(Type.HTTP, new InetSocketAddress(proxyHost, proxyPort))); return new RestTemplate(factory); } But this configuration is overridden by OAuth2AccessTokenSupport.restTemplate. So the below

Spring Oauth2.0 Missing grant type

柔情痞子 提交于 2019-11-29 06:30:35
I am using Spring Oauth 2.O. When I pass request as a form-data it works fine, but when I try to pass data in application/json format it gives me error missing grant type. Request http://localhost:8080/oauth/token {"username":"parths","password":"123456","grant_type":"password"} Error I getting. { "status": "0", "message": "Missing grant type" } Please Guide. OAuth2 doesn't support JSON in the access token request.You can check here for description ..It requires application/x-www-form-urlencoded 来源: https://stackoverflow.com/questions/39366281/spring-oauth2-0-missing-grant-type

Single sign off using OAuth 2

早过忘川 提交于 2019-11-29 06:13:38
We just have been discussing the login and logout behaviour when using OAuth 2. Let's say we have two webapps A and B using one OAuth provider O (built using the spring-security-oauth2 stack). When you want to login to A you get redirected to O , enter your credentials, get a session there on O , redirected back to A with an access token and a session is created on A as well. Now when you want to login to B you get redirected to O , get directly sent back with a token to B because you still have a valid sesison on O and a session is created on B as well (without having to enter your

Protecting REST API with OAuth2: Error creating bean with name 'scopedTarget.oauth2ClientContext': Scope 'session' is not active

心已入冬 提交于 2019-11-29 05:34:29
I've been working for a few days to attempt to implement oauth2 protection on a REST API. I've tried a ton of different configurations but still haven't managed to get it to work. I'm proving the code that I have right now, but I'm in no way married to this implementation. If you can show me some radically different way to accomplish what I want to accomplish, great. My flow looks like this: Client checks Auth Server, gets token. Client sends token to Resource Server. Resource Server uses Auth Server to make sure that token is valid. The Auth Server works fine. I'm having trouble configuring

Customize auth error from Spring Security using OAuth2

喜欢而已 提交于 2019-11-29 04:31:25
I was wondering if I could customize the following authorization error: { "error": "unauthorized", "error_description": "Full authentication is required to access this resource" } I get it when the user request does not have permissions. And I would like to customize it to be quite similar than Spring Boot error: { "timestamp":1445441285803, "status":401, "error":"Unauthorized", "message":"Bad credentials", "path":"/oauth/token" } Could it be possible? Many thanks. I got it :) https://stackoverflow.com/a/37132751/2520689 I need to create a new class which implements "AuthenticationEntryPoint"

How to call JHipster (Spring) OAuth2 Rest server using Postman Authentication helpers

放肆的年华 提交于 2019-11-29 03:05:28
问题 Postman has Authentication helpers to help with authenticated calls and I'm trying to use the OAuth 2.0 helper to call a REST server created by JHipster using Spring (Security, Social, etc). I've tried a lot of configurations, this is the screen (client ID and Secret were masked): For the Authorization URL I've tried: http://127.0.0.1:8080/oauth/authorize http://127.0.0.1:8080/#/login (the app's login route) The closer I get from receiving a token back to Postman is: I don't know why it's

Using scopes as roles in Spring Security OAuth2 (provider)

跟風遠走 提交于 2019-11-29 00:16:43
问题 Let's consider a fairly simple hypothetical application where users can read or write posts. Some users can read and write articles while some others can only read them. With Spring Security (3.2.1) I modeled this by having 2 roles: ROLE_WRITE: this role grants users access to writing posts. ROLE_READ: this role grants users access to reading posts. Implementing this with Spring security is fairly straightforward... Now I want to also allow third-party apps to read and write posts on behalf

null client in OAuth2 Multi-Factor Authentication

喜欢而已 提交于 2019-11-28 20:53:02
Complete code for a Spring OAuth2 implementation of multi-factor authentication has been uploaded to a file sharing site that you can download by clicking on this link . Instructions below explain how to use the link to recreate the current problem on any computer. A 500 point bounty is offered. THE CURRENT ERROR: An error is being triggered when a user tries to authenticate using two factor authentication in the Spring Boot OAuth2 app from the link in the preceding paragraph . The error is thrown at the point in the process when the app should serve up a second page asking the user for a pin

Two factor authentication with spring security oauth2

半腔热情 提交于 2019-11-28 17:56:02
I'm looking for ideas how to implement two factor authentication (2FA) with spring security OAuth2. The requirement is that the user needs two factor authentication only for specific applications with sensitive information. Those webapps have their own client ids. One idea that popped in my mind would be to "mis-use" the scope approval page to force the user to enter the 2FA code/PIN (or whatever). Sample flows would look like this: Accessing apps without and with 2FA User is logged out User accesses app A which does not require 2FA Redirect to OAuth app, user logs in with username and

How to change spring security oauth2 default token endpoint?

杀马特。学长 韩版系。学妹 提交于 2019-11-28 16:52:38
We have spring security oauth2 based application. Every thing is working fine. But i am failed to change default token endpoint from "/oauth/token" to "/external/oauth/token". My spring-servlet.xml <http pattern="/external/oauth/token" create-session="stateless" authentication-manager-ref="clientAuthenticationManager" use-expressions="true" xmlns="http://www.springframework.org/schema/security"> <intercept-url pattern="/external/oauth/token" access="isFullyAuthenticated()" /> <anonymous enabled="false" /> <http-basic entry-point-ref="clientAuthenticationEntryPoint" /> <!-- include this only if