oauth-2.0 相关问题

OAuth(开放授权)是一种开放式协议框架,允许以简单和标准化的方式为桌面,移动和Web应用程序提供安全的API授权。 OAuth 2.0是OAuth协议的第二个版本。

了解 PKCE 与授权代码授予的好处

我是 OAuth 世界的新手,我正在尝试了解使用 PKCE 相对于传统授权代码授予的好处。 (我的许多假设可能是错误的,所以我感谢您的

回答 1 投票 0

如何使用 C#/C++/librdkafka 与 OIDC 和 Azure AD 作为 apache kafka 中 OAUTHBEARER 的令牌提供程序?

我尝试使用 C# 向 Apache Kafka 生成消息。但我注意到有一个名为 sasl.login.callback.handler.class 的配置,应该在 kafka 生产者客户端中配置。但我找不到

回答 1 投票 0

如何验证来自 oauth 提供商的 jwt 令牌?

我正在开发一个项目,以 next-js/next-auth 作为前端,并以express 作为后端服务器。所以我想要弄清楚的是,一旦我通过第三方提供商的身份验证(Git...

回答 1 投票 0

AuthenticateResult.Principal 尝试通过 Google 进行身份验证时为 null

我试图允许用户在我的 ASP.NET Core Blazor 应用程序上使用他们的 Google 帐户登录。每当我进入我的 app/login/google-login 时,一切都会按预期进行。我被重定向到谷歌的l...

回答 2 投票 0

Azure Spring Boot - 获取登录用户的 OAuth 2.0 访问令牌

我使用 azure-active-directory-spring-boot-starter 来保护 Spring Boot 应用程序中的端点。这工作正常 - 当用户访问我的应用程序时,他们会被重定向到 Azure 以查看...

回答 2 投票 0

在 OpenID Connect 与 PKCE 中,客户端如何知道在用户重定向后使用哪个授权码发送哪个 code_verifier?

我正在学习有关 OpenID Connect 授权代码工作流程的 ASP.NET 安全课程,该课程具有针对代码重放攻击的 PKCE 保护。这个过程有一个方面我不明白。

回答 3 投票 0

如何使用@react-oauth/google 处理登录/注销

我正在开发一个业余项目,允许用户登录 Google 并访问/管理他们的 Google 图书内容。 到目前为止,我已经通过 @react-oauth/google 登录 Google。这是...

回答 1 投票 0

类型错误:使用 Base 64 时,“模块”对象不可调用

我正在使用 Spotify API,并且收到时间错误 TypeError: 'module' object is not callable 特别是我的代码中处理授权流程的部分 def get_info(代码): ...

回答 1 投票 0

Google OAuth2 范围被视为“敏感”的列表在哪里?

据我了解,Google OAuth2 范围大致分为三个部分,按从最难获准使用到最难的顺序排列: 限制范围 灵敏范围 其他一切 我发现了一个李...

回答 2 投票 0

使用react-oauth/google更改范围时遇到问题

我的网络应用程序使用react-oauth/google的隐式流程作为获取GoogleAPI授权的方式,以便使用DriveAPI/GooglePickerAPI。我已将驱动器配置为同意屏幕中的范围,但是...

回答 1 投票 0

FastAPI Docs 基于日志的安全示例

我设法使用在线文档安全部分示例使用 FastAPI 构建了一个登录系统。它或多或少是相同的,除了你必须从 MySql 获取用户。 我有两个问题。 我可以...

回答 1 投票 0

Spring Security 6 - OAuth2 登录后使用 JWT 令牌而不是 JSESSIONID

我看过几篇帖子谈论类似的事情,尽管与我想做的不完全一样。也就是说,我遇到了 https://www.jessym.com/articles/stateless-oauth2-social-logins-with-...

回答 1 投票 0

Twitter API v2:403 禁止 - “使用附加到项目的 Twitter 开发者应用程序中的密钥”

我使用 Laravel/Socialite 与 Twitter API v2 交互已经有一段时间了,直到上周一切都工作正常。我在消息中遇到“403 Forbidden”错误...

回答 1 投票 0

使用 Spring Authorization Server 进行身份验证(和授权)时,它有哪些可能性?

我正在寻找一种工具来完成项目的身份验证(和授权)部分。对于该项目,我将使用 spring boot 和 java 8。 我将使用 OAuth2.0,flo...

回答 2 投票 0

只需要oidc中的ID令牌

我使用的是 oidc 中间件,配置如下: oidc配置 = { 发行者:configObj.oktaIssuer, client_id: global.configuration.oktaClientId, client_secret:全局.配置。

回答 1 投票 0

来自 Google 证书的 RSA256 公钥无法获得一个密钥

为了验证 google oauth2 令牌,我根据模数 (n) 和指数 (e) 为孩子“b863b534069bfc0207197bcf831320d1cdc2cee2”生成公钥: https://www.googleapis.com/oauth2/v3/

回答 2 投票 0

为什么使用 iFrame 进行静默身份验证?

我在多个页面上读到隐藏的 iFrame 用于静默身份验证,但我还不知道为什么。与直接发送 GET 请求相比,使用 iFrame 有什么好处...

回答 1 投票 0

使用 Oauth2 通过 POST 进行 SSO Azure AD 身份验证 - PHP

我已经编写了一个使用 Azure AD 登录的代码,它工作正常,但是当我将其重定向到下一页时,带有值的会话变量变空,我已粘贴代码以供参考。 $appid...

回答 1 投票 0

使用 Spring Security 框架和客户端登录表单实现 OAuth2.0 Auth 服务器

我目前正在尝试使用 Spring Security 框架实现 OAuth2.0 授权服务器: org.springframework.boot 我目前正在尝试使用 Spring Security 框架实现 OAuth2.0 授权服务器: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-authorization-server</artifactId> <version>0.3.0</version> </dependency> 我的初始实现遵循标准授权代码与 PKCE 流程: 客户端必须首先调用我的身份验证服务器的授权端点,例如: https://authorization-server.com/authorize?response_type=code&client_id=zMP_79LS2UPtyFa1z0TrdwoN&redirect_uri=https://www.oauth.com/playground/authorization-code-with-pkce.html&scope=photo+offline_access&state=0OaV1kmkkK8yFbqe&code_challenge=WVe6cGEQGlHk3hXXpyUo4hvs2uzCg4j3-oXfnX9L6HA&code_challenge_method=S256 身份验证服务器将呈现一个登录表单来对用户进行身份验证。 然后授权服务器会回复授权码到重定向uri(客户端) 客户端将另一个请求发送回身份验证服务器。这一次,它将调用令牌端点,提供从步骤 3 收到的授权代码。 https://authorization-server.com/token?grant_type=authorization_code&client_id=zMP_79LS2UPtyFa1z0TrdwoN&client_secret=VvfjKzAWIr0bxWKTUvzC48NkzlhwnAuSOsWOb6C8AdG7GH5O&redirect_uri=https://www.oauth.com/playground/authorization-code-with-pkce.html&code=z9dJErNexuAL0VRaOu9AfxhMuOJL-IT7zY5HILeKFW5XmFOT&code_verifier=Q3TsNTc5__76nzRtp43zjVJ3yxD_P1WD-khqJ7rdTxS_l73w 身份验证服务器现在将回复访问令牌 到目前为止一切顺利。一切顺利。 但现在我想改变行为并让客户端(使用 React 的前端)呈现登录表单而不是身份验证服务器: 客户端呈现登录表单。 客户端通过调用后端RESTful API(/auth/login)将用户名/密码发送到后端 将此行为集成到 OAuth2.0 Spring 安全框架中是否可行?我想要做的是从 RESTful API 端点: 我将使用自定义的身份验证提供程序对用户进行身份验证 将经过身份验证的用户注入 OAuth2.0 框架并让它沿着框架运行,以便 Auth 服务器仍然会向重定向 uri 发送授权代码,而无需在后端呈现登录表单,因为用户名/密码已经已经由前端提供了。 非常感谢。 到目前为止我尝试过的: 创建自定义的身份验证处理程序来验证用户名/密码 @Configuration @EnableWebSecurity @RequiredArgsConstructor public class WebSecurityConfig { private final CustomAuthenticationProvider customAuthenticationProvider; @Bean public AuthenticationManager authenticationManager(HttpSecurity http) throws Exception { AuthenticationManagerBuilder builder = http.getSharedObject(AuthenticationManagerBuilder.class); builder.userDetailsService(customUserDetailService); builder.authenticationProvider(customAuthenticationProvider); return builder.build(); } } @Service @Service @RequiredArgsConstructor public class CustomAuthenticationProvider implements AuthenticationProvider { private final CustomUserDetailService customUserDetailService; private final PasswordEncoder passwordEncoder; @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { String username = authentication.getName(); String password = authentication.getCredentials().toString(); E2AuthUserDetails user = (E2AuthUserDetails) customUserDetailService.loadUserByUsername(username); return checkPassword(user, password); } private Authentication checkPassword(UserDetails user, String rawLoginPassword) { String dbPassword = user.getPassword(); if (passwordEncoder.matches(rawLoginPassword, dbPassword)) { return new UsernamePasswordAuthenticationToken(user.getUsername(), dbPassword, user.getAuthorities()); } else { throw new BadCredentialsException("Bad Credentials"); } } @Override public boolean supports(Class<?> authentication) { return UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication); } } @Service @RequiredArgsConstructor public class AuthService { private final AuthenticationManager authenticationManager; public LoginResponse attemptLogin(String email, String password) { var authentication = authenticationManager.authenticate( new UsernamePasswordAuthenticationToken(email, password) ); SecurityContextHolder.getContext().setAuthentication(authentication); } } 设置授权服务器配置 @Configuration(proxyBeanMethods = false) public class AuthorizationServerConfig { @Autowired private CustomUserDetailsService customUserDetailsService; @Autowired private PasswordEncoder passwordEncoder; // Add a customized security filter and set this as the first in the chain @Bean @Order(Ordered.HIGHEST_PRECEDENCE) public SecurityFilterChain authServerSecurityFilterChain(HttpSecurity http) throws Exception { OAuth2AuthorizationServerConfiguration.applyDefaultSecurity(http); return http.formLogin(Customizer.withDefaults()).build(); } // Customize client registration @Bean public RegisteredClientRepository registeredClientRepository() { RegisteredClient registeredClient = RegisteredClient.withId(UUID.randomUUID().toString()) .clientId("client") .clientSecret(passwordEncoder.encode("secret")) .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC) .clientAuthenticationMethod(ClientAuthenticationMethod.BASIC) .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE) .redirectUri("http://spring.io/auth") .scope(OidcScopes.OPENID) .build(); return new InMemoryRegisteredClientRepository(registeredClient); } // Setup OAuth endpoints and other default config @Bean public ProviderSettings providerSettings() { return ProviderSettings.builder() //.issuer("http://auth-server:9000") .build(); } } 在客户端收集用户凭据并将其发送到授权服务器将是password流程。不要这样做:出于安全原因它已被弃用。坚持 authorization_code 流程并在授权服务器上设置登录表单的样式,以保持应用程序的外观和风格。 此外,React 应用程序(以及任何其他单页面或移动应用程序)会导致 OAuth2 客户端不安全。根据最新建议,OAuth2 客户端应在您的服务器上运行并“保密”。从前端(在您的情况下为 React)到后端入口点(“BFF”)的请求将通过会话进行授权。作为 BFF,您可以将 spring-cloud-gateway 与 oauth2Login 和 TokenRelay 过滤器一起使用。我为此写了一个教程(它使用 Angular,但在 BFF 上登录/注销并从后端获取用户数据的打字稿代码对于移植来说很简单)

回答 1 投票 0

使用 OAUTH2 连接到 Outlook Office 365 IMAP

参考https://msdn.microsoft.com/en-us/office/office365/api/use-outlook-rest-api。 我还是看不懂AD、Outlook和windows live。 我从 https://

回答 4 投票 0

© www.soinside.com 2019 - 2023. All rights reserved.