mirror of
https://github.com/google/nomulus.git
synced 2025-05-17 17:59:41 +02:00
Add XSRF protection to legacy authentication mechanism
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=148689952
This commit is contained in:
parent
a5932c0fc3
commit
c7a62e9b98
12 changed files with 227 additions and 56 deletions
|
@ -16,12 +16,9 @@ package google.registry.request.auth;
|
|||
|
||||
import com.google.appengine.api.oauth.OAuthService;
|
||||
import com.google.appengine.api.oauth.OAuthServiceFactory;
|
||||
import com.google.appengine.api.users.UserService;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
|
||||
/**
|
||||
* Dagger module for authentication routines.
|
||||
|
@ -29,28 +26,12 @@ import google.registry.config.RegistryConfig.Config;
|
|||
@Module
|
||||
public class AuthModule {
|
||||
|
||||
/** Provides the internal authentication mechanism. */
|
||||
@Provides
|
||||
AppEngineInternalAuthenticationMechanism provideAppEngineInternalAuthenticationMechanism() {
|
||||
return new AppEngineInternalAuthenticationMechanism();
|
||||
}
|
||||
|
||||
/** Provides the custom authentication mechanisms (including OAuth). */
|
||||
@Provides
|
||||
ImmutableList<AuthenticationMechanism> provideApiAuthenticationMechanisms(
|
||||
OAuthService oauthService,
|
||||
@Config("availableOauthScopes") ImmutableSet<String> availableOauthScopes,
|
||||
@Config("requiredOauthScopes") ImmutableSet<String> requiredOauthScopes,
|
||||
@Config("allowedOauthClientIds") ImmutableSet<String> allowedOauthClientIds) {
|
||||
OAuthAuthenticationMechanism oauthAuthenticationMechanism) {
|
||||
return ImmutableList.<AuthenticationMechanism>of(
|
||||
new OAuthAuthenticationMechanism(
|
||||
oauthService, availableOauthScopes, requiredOauthScopes, allowedOauthClientIds));
|
||||
}
|
||||
|
||||
/** Provides the legacy authentication mechanism. */
|
||||
@Provides
|
||||
LegacyAuthenticationMechanism provideLegacyAuthenticationMechanism(UserService userService) {
|
||||
return new LegacyAuthenticationMechanism(userService);
|
||||
oauthAuthenticationMechanism);
|
||||
}
|
||||
|
||||
/** Provides the OAuthService instance. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue