mirror of
https://github.com/google/nomulus
synced 2026-08-01 04:46:08 +00:00
Use pipe as extension URI separator (#2737)
It turns out period can be used in the URI, such as in "urn:ietf:params:xml:ns:fee-0.12". I don't think pipe is used, at least not according to EPP URI namespace naming convention. Ideally we'd use serialization, but using the default serialization runs the risk of it being platform/JDK dependent, so a new deployment might not be able to deserialize existing cookies. A custom serializer that guarantees stability would have been needed.
This commit is contained in:
@@ -103,7 +103,7 @@ public class CookieSessionMetadata extends SessionMetadata {
|
||||
@Override
|
||||
public Set<String> getServiceExtensionUris() {
|
||||
return Optional.ofNullable(data.getOrDefault(SERVICE_EXTENSIONS, null))
|
||||
.map(s -> Splitter.on('.').splitToList(s))
|
||||
.map(s -> Splitter.on(URI_SEPARATOR).splitToList(s))
|
||||
.map(ImmutableSet::copyOf)
|
||||
.orElse(ImmutableSet.of());
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class CookieSessionMetadata extends SessionMetadata {
|
||||
if (serviceExtensionUris == null || serviceExtensionUris.isEmpty()) {
|
||||
data.remove(SERVICE_EXTENSIONS);
|
||||
} else {
|
||||
data.put(SERVICE_EXTENSIONS, Joiner.on('.').join(serviceExtensionUris));
|
||||
data.put(SERVICE_EXTENSIONS, Joiner.on(URI_SEPARATOR).join(serviceExtensionUris));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ import java.util.Set;
|
||||
/** Object to allow setting and retrieving session information in flows. */
|
||||
public abstract class SessionMetadata {
|
||||
|
||||
protected static final char URI_SEPARATOR = '|';
|
||||
|
||||
/**
|
||||
* Invalidates the session. A new instance must be created after this for future sessions.
|
||||
* Attempts to invoke methods of this class after this method has been called will throw {@code
|
||||
@@ -50,7 +52,9 @@ public abstract class SessionMetadata {
|
||||
return toStringHelper(getClass())
|
||||
.add("clientId", getRegistrarId())
|
||||
.add("failedLoginAttempts", getFailedLoginAttempts())
|
||||
.add("serviceExtensionUris", Joiner.on('.').join(nullToEmpty(getServiceExtensionUris())))
|
||||
.add(
|
||||
"serviceExtensionUris",
|
||||
Joiner.on(URI_SEPARATOR).join(nullToEmpty(getServiceExtensionUris())))
|
||||
.toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user