我正在开发一个Java Springboot Web应用程序。在其中我有多个用户登录与地址邮件和密码。登录是OK的。
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/error.xhtml").permitAll().antMatchers("/error-404.xhtml").permitAll()
.anyRequest().authenticated().accessDeniedPage("/accessDenied.xhtml");
;
// login
http.formLogin().loginPage("/login").permitAll().failureUrl("/login?error=1");
// logout
http.logout().logoutSuccessUrl("/login").invalidateHttpSession(true).deleteCookies("JSESSIONID");
http.formLogin().defaultSuccessUrl("/dashboard", true);
http.csrf().disable();
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Override
public void configure(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception {
authenticationManagerBuilder.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
我不想用谷歌登录。我需要将他们的谷歌日历应用程序帐户,所以他们不能创建事件和会议使用他们的Gmail ID。
有没有什么方法,我可以通过必须得到用户的同意,只有一次在设置中集成他们的谷歌帐户到应用程序.
1条答案
按热度按时间wfsdck301#
你应该看看official sample
如果FileDataStoreFactory配置正确,它将存储每个用户的凭据,那么您只需请求访问一次。
更新:
评论中的问题
1.how正确配置FileDataStoreFactory存储每个用户的凭据,并使用连接的用户的凭据?
检查下面的示例
.authorize("user");
将表示用户并存储该用户的信用。1.如何切断一个帐户?
通过调用撤销端点或删除它们上面存储的文件。它将强制您的应用再次请求授权。