mirror of
https://github.com/google/nomulus.git
synced 2025-06-12 23:44:46 +02:00
Reimplement the RDAP Json creation using Jsonables
Currently we try to reimplemnet the same behavior of the existing code as much as possible. We only fix issues that go against the RFC7483, but we don't yet update the code to follow the latest (15feb19) RDAP Response Profile. That will require a much bigger change especially for the test files, so it'll wait for a followup CL. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=246948018
This commit is contained in:
parent
5e2a20cdcf
commit
7202a38f8b
85 changed files with 2589 additions and 2367 deletions
|
@ -1,52 +0,0 @@
|
|||
// 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.config;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* AutoValue class describing an RDAP Notice object.
|
||||
*
|
||||
* <p>This is used for injecting RDAP help pages.
|
||||
*/
|
||||
@AutoValue
|
||||
public abstract class RdapNoticeDescriptor {
|
||||
|
||||
public static Builder builder() {
|
||||
return new AutoValue_RdapNoticeDescriptor.Builder();
|
||||
}
|
||||
|
||||
@Nullable public abstract String getTitle();
|
||||
public abstract ImmutableList<String> getDescription();
|
||||
@Nullable public abstract String getTypeString();
|
||||
@Nullable public abstract String getLinkValueSuffix();
|
||||
@Nullable public abstract String getLinkHrefUrlString();
|
||||
|
||||
/** Builder class for {@link RdapNoticeDescriptor}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
|
||||
public abstract Builder setTitle(@Nullable String title);
|
||||
public abstract Builder setDescription(Iterable<String> description);
|
||||
public abstract Builder setTypeString(@Nullable String typeString);
|
||||
public abstract Builder setLinkValueSuffix(@Nullable String linkValueSuffix);
|
||||
public abstract Builder setLinkHrefUrlString(@Nullable String linkHrefUrlString);
|
||||
|
||||
public abstract RdapNoticeDescriptor build();
|
||||
}
|
||||
}
|
||||
|
|
@ -26,7 +26,6 @@ import com.google.common.base.Splitter;
|
|||
import com.google.common.base.Strings;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
@ -1267,19 +1266,6 @@ public final class RegistryConfig {
|
|||
return ImmutableList.copyOf(config.credentialOAuth.localCredentialOauthScopes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the help path for the RDAP terms of service.
|
||||
*
|
||||
* <p>Make sure that this path is equal to the key of the entry in the RDAP help map containing
|
||||
* the terms of service. The ICANN operational profile requires that the TOS be included in all
|
||||
* responses, and this string is used to find the TOS in the help map.
|
||||
*/
|
||||
@Provides
|
||||
@Config("rdapTosPath")
|
||||
public static String provideRdapTosPath() {
|
||||
return "/tos";
|
||||
}
|
||||
|
||||
/** OAuth client ID used by the nomulus tool. */
|
||||
@Provides
|
||||
@Config("toolsClientId")
|
||||
|
@ -1311,51 +1297,6 @@ public final class RegistryConfig {
|
|||
public static String provideRdapTosStaticUrl(RegistryConfigSettings config) {
|
||||
return config.registryPolicy.rdapTosStaticUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the help text to be used by RDAP.
|
||||
*
|
||||
* <p>Make sure that the map entry for the terms of service use the same key as specified in
|
||||
* rdapTosPath above.
|
||||
*/
|
||||
@Singleton
|
||||
@Provides
|
||||
@Config("rdapHelpMap")
|
||||
public static ImmutableMap<String, RdapNoticeDescriptor> provideRdapHelpMap(
|
||||
@Config("rdapTos") ImmutableList<String> rdapTos,
|
||||
@Config("rdapTosStaticUrl") @Nullable String rdapTosStaticUrl) {
|
||||
return new ImmutableMap.Builder<String, RdapNoticeDescriptor>()
|
||||
.put(
|
||||
"/",
|
||||
RdapNoticeDescriptor.builder()
|
||||
.setTitle("RDAP Help")
|
||||
.setDescription(
|
||||
ImmutableList.of(
|
||||
"domain/XXXX",
|
||||
"nameserver/XXXX",
|
||||
"entity/XXXX",
|
||||
"domains?name=XXXX",
|
||||
"domains?nsLdhName=XXXX",
|
||||
"domains?nsIp=XXXX",
|
||||
"nameservers?name=XXXX",
|
||||
"nameservers?ip=XXXX",
|
||||
"entities?fn=XXXX",
|
||||
"entities?handle=XXXX",
|
||||
"help/XXXX"))
|
||||
.setLinkValueSuffix("help/")
|
||||
.setLinkHrefUrlString(
|
||||
"https://github.com/google/nomulus/blob/master/docs/rdap.md")
|
||||
.build())
|
||||
.put(
|
||||
"/tos",
|
||||
RdapNoticeDescriptor.builder()
|
||||
.setTitle("RDAP Terms of Service")
|
||||
.setDescription(rdapTos)
|
||||
.setLinkValueSuffix("help/tos")
|
||||
.setLinkHrefUrlString(rdapTosStaticUrl)
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue