oauth2

OAuth flow when user is already logged in to the Oauth Provider

隐身守侯 提交于 2019-12-05 10:19:58
So, a basic OAuth2 flow using authorization grant type would normally go as follows, (assume OAuth Client=Quora, OAuth Server=Google, for eg. purposes): User goes to Client, is redirected to Server sign in page for authentication. User logins to Server, and Server returns an authorization_code to Client. Client then makes a call with client_id, client_secret and authorization_code to Server to fetch the token. Server validates and replies back with token. Client can now access api/resources from Server with the token. Now, if the user already logged in to say, Server first, then tries to

How to get real estate data with Idealista API?

时光怂恿深爱的人放手 提交于 2019-12-04 23:32:23
I've been trying to use the API of the website Idealista ( https://www.idealista.com/ ) to retrieve information of real estate data. Since I'm not familiarized with OAuth2 I haven't been able to obtain the token so far. I have just been provided with the api key, the secret and some basic info of how to mount the http request. I would appreciate an example (preferably in Python) of the functioning of this API, or else some more generic info about dealing with OAuth2 and Python. After some days of research I came up with a basic python code to retrieve real estate data from the Idealista API.

OpenIdConnectAuthenticationHandler: message.State is null or empty

不羁的心 提交于 2019-12-04 16:43:32
I am using UseOpenIdConnectAuthentication middleware for ASP.Net Core application to authenticate against Dells Cloud access manager token provider (setup to provide OpenId/OAuth2 authentication). Following is the code: app.UseCookieAuthentication(new CookieAuthenticationOptions { AutomaticAuthenticate = true, AutomaticChallenge = true, AuthenticationScheme = "ClientCookie", CookieName = CookieAuthenticationDefaults.CookiePrefix + "ClientCookie", ExpireTimeSpan = TimeSpan.FromMinutes(5), LoginPath = new PathString("/signin"), LogoutPath = new PathString("/signout") }); app

How to add a RequestContextListener with no-xml configuration?

跟風遠走 提交于 2019-12-04 04:08:32
I need to add a listener to my Spring Boot application, in web.xml it looks like <listener> <listener-class> org.springframework.web.context.request.RequestContextListener </listener-class> </listener> I use no-web.xml configuration, so I've got a class like public class AppFilterConfig extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Filter[] getServletFilters() { CharacterEncodingFilter filter = new CharacterEncodingFilter(); filter.setEncoding("UTF8"); filter.setForceEncoding(true); Filter[] filters = new Filter[1]; filters[0] = filter; return filters; }

Lumen与Oauth2的整合

a 夏天 提交于 2019-12-03 14:32:54
今天来写一下laravel的分支lumen这个“微框架”,大家看到这个“微”字,总以为是laravel的简化版本,其实不然也。可以去他的官网好好看看。链接地址: https://lumen.laravel.com/docs/5.2/releases 因为最近项目中要用到接口,就用Lumen快速的部署了一下站点。不过Lumen的环境有一定的要求,最好是高版本的, 官方建议是: PHP >= 5.5.9 OpenSSL PHP Extension PDO PHP Extension Mbstring PHP Extension 1、oauth2 既然说到接口,那肯定有授权协议,这里首选是"oauth2"了。这里可以看一下国外一篇文章: http://esbenp.github.io/2015/05/26/lumen-web-api-oauth-2-authentication/ 这里详细的介绍怎么配置,我当初安装他的步骤配置过,可依旧报错, 其中一个是: proxy.php First parameter must either be an object or the name of an existing class 解决方案为: 其中要注意的是在.env 配置选项 AUTH_MODEL=App\Auth\User Lumen默认缓存是memcached,CACHE_DRIVER

spring-security : How to get OAuth2 userInfo during sso logged in?

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I implement oauth2 sso by using @EnableOAuth2Sso on spring-boot:1.3.0.M1 I want to use my userInfo from my resource server ( http://oauth2_resource_server/me ). So I try to implement my own ResourceServerTokenServices refering to UserInfoTokenServices @Configuration @EnableWebSecurity @EnableOAuth2Sso public class OAuth2Config { @Autowired ResourceServerProperties sso; @Bean public ResourceServerTokenServices userInfoTokenServices() { return new MyTokenService(sso.getUserInfoUri(), sso.getClientId()); } } public class MyTokenService

Error refreshing the OAuth2 token { “error” : “invalid_grant” }

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: please help me to understand where mistake. API Google Api PHP v3, key.p12 is the file in the .zip collection API (or where i find it ?) I masked my data with xxxxxxxxxx Excuse me for my inglish gaphp.php <?php require_once 'Google/Client.php'; require_once 'Google/Service/Analytics.php'; $client_id = 'xxx-xxx.apps.googleusercontent.com'; $service_account_name = 'xxx-xxx@developer.gserviceaccount.com'; $keyfile = 'key.p12'; $redirect_url = 'http://example.com/service/ga/gaphp.php'; $client_secret = 'xxxxxxxxxxxxxxxxxxxxx'; // Initialise the

com.google.api.client.auth.oauth2.TokenResponseException: 401 Unauthorized

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to use Java Google Drive API. I tried this code: public Drive getDriveService() throws GeneralSecurityException, IOException, URISyntaxException { HttpTransport httpTransport = new NetHttpTransport(); JacksonFactory JSON_FACTORY = new JacksonFactory(); GoogleCredential credential = new GoogleCredential.Builder() .setTransport(httpTransport) .setJsonFactory(JSON_FACTORY) .setServiceAccountId("sonoratestw-226@sonora-project.iam.gserviceaccount.com") .setServiceAccountPrivateKeyFromP12File(new java.io.File("C:\\buffer\\sonora project

Using Spreadsheet API OAuth2 with Certificate Authentication

匿名 (未验证) 提交于 2019-12-03 08:28:06
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to use Gdata Spreadsheet API with OAuth2. Using OAuth2.0 ClientID works with OAuth2WebServerFlow on a domain, But using Service Accounts / Certificate causes a 400 BAD Request The scopes used are https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/admin.directory.group.readonly https://www.googleapis.com/auth/admin.directory.user.readonly https://docs.google.com/feeds/ https://spreadsheets.google.com/feeds Here is the code that I am using SUCCEEDS :

Spring Security Web 和 OAuth2

六眼飞鱼酱① 提交于 2019-12-03 08:05:58
前言 Spring Security Core Spring Security Web 过滤器链的构建 过滤器链的调用 过滤器链的使用 Spring Security OAuth2 授权服务器 授权码模式 密码模式 客户端认证 TokenGranter 资源服务器 Spring Security JWT 结语 参考链接 前言 Spring Security 是一个多模块的项目,之前梳理了一下 Spring Security 认证流程 ,现在才发现,梳理的那部分内容更多的只是 Spring Security Core 这个核心模块中的内容。 日常使用时,还会更多的涉及 Spring Security Web 和 Spring Security OAuth2 中的东西,这篇博客的主要内容便是梳理一下这三者之间的关系,了解一下各自发挥的作用。 Spring Security Core Spring Security Core 在整个 Spring Security 框架中扮演着重要的角色,提供了有关于认证和权限控制相关的抽象。 然而,在使用的过程中,我们接触的更多的可能是和认证相关的抽象,比如: 通过 AuthenticationManager 提供了进行用户认证方法的抽象,允许通过 ProviderManager 和 AuthenticationProvider