mirror of
https://github.com/google/nomulus.git
synced 2025-05-02 13:07:50 +02:00
This uses an extensibility mechanism similar to that of WhoisCommandFactory and CustomLogicFactory, namely, that a fully qualified Java class is specified in the YAML file for each environment with the allocation token custom logic to be used. By default, this points to a no-op base class that does nothing. Users that wish to add their own allocation token custom logic can simply create a new class that extends AllocationTokenCustomLogic and then configure it in their .yaml config files. This also renames the existing *FlowCustomLogic *Flow instance variables from customLogic to flowCustomLogic, to avoid the potential confusion with the new AllocationTokenCustomLogic class that also now exists. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=183003112
44 lines
1.6 KiB
Java
44 lines
1.6 KiB
Java
// Copyright 2017 The Nomulus Authors. All Rights Reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package google.registry.flows.domain.token;
|
|
|
|
import com.google.common.collect.ImmutableMap;
|
|
import com.google.common.net.InternetDomainName;
|
|
import google.registry.flows.EppException;
|
|
import google.registry.model.domain.AllocationToken;
|
|
import google.registry.model.registry.Registry;
|
|
|
|
/**
|
|
* A no-op base class for allocation token custom logic.
|
|
*
|
|
* <p>Extend this class and override the hook(s) to perform custom logic.
|
|
*/
|
|
public class AllocationTokenCustomLogic {
|
|
|
|
/** Performs additional custom logic for verifying a token. */
|
|
public AllocationToken verifyToken(
|
|
InternetDomainName domainName, AllocationToken token, Registry registry, String clientId)
|
|
throws EppException {
|
|
// Do nothing.
|
|
return token;
|
|
}
|
|
|
|
/** Performs additional custom logic for performing domain checks using a token. */
|
|
public ImmutableMap<String, String> checkDomainsWithToken(
|
|
ImmutableMap<String, String> checkResults, AllocationToken tokenEntity, String clientId) {
|
|
// Do nothing.
|
|
return checkResults;
|
|
}
|
|
}
|