Tag: 模仿

spring security(3.0.x)和用户模仿

在我的Web应用程序中,有时经过身份validation的管理员可能想要冒充系统的另一个有效用户而无需知道该用户的密码。 如何使用Spring Security为管理员用户提供模拟系统正常(非管理员)用户的能力? Spring Security文档对此保持沉默,我无法在任何地方找到任何内容。 当然有人必须解决这个问题。 谢谢!

google oauth2使用user@gmail.com模拟服务帐户

我想访问一些谷歌API服务: GDrive API 联系API People API 我正在努力使用oauth2模拟服务帐户流程(您知道其中一个: Google Oauth v2 – 服务帐户说明 。要进行模拟,您需要在Google Apps控制台中应用“委派域范围权限”,下载对应的pk12文件并激活谷歌控制台项目中的API。 目前我总是得到: com.google.api.client.auth.oauth2.TokenResponseException: 401 Unauthorized at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:105) at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:287) at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:307) at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:384) at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:489) at oauthsample.GDriveAPI.(GDriveAPI.java:50) at oauthsample.GDriveAPI.main(GDriveAPI.java:85) 这是我的代码: HttpTransport httpTransport = new NetHttpTransport(); JacksonFactory jsonFactory = new JacksonFactory(); Set scopes = new HashSet(); scopes.add(“https://www.google.com/m8/feeds”); GoogleCredential credential = new GoogleCredential.Builder() .setTransport(httpTransport) […]