a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington/*
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * The contents of this file are subject to the terms of the Common Development and
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * Distribution License (the License). You may not use this file except in compliance with the
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * License.
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington *
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * specific language governing permission and limitations under the License.
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington *
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * When distributing Covered Software, include this CDDL Header Notice in each file and include
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * Header, with the fields enclosed by brackets [] replaced by your own identifying
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * information: "Portions copyright [year] [name of copyright owner]".
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington *
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * Copyright 2015 ForgeRock AS.
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington */
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington
a093731116a8c24d49b903df7602cf586e499b45Phill Cunningtonpackage com.sun.identity.sm;
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington
a093731116a8c24d49b903df7602cf586e499b45Phill Cunningtonimport java.util.Set;
a093731116a8c24d49b903df7602cf586e499b45Phill Cunningtonimport java.util.concurrent.CopyOnWriteArraySet;
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington/**
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * Manager for maintaining list of REST endpoints that cannot be used as realm names.
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington *
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * @since 13.0.0
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington */
a093731116a8c24d49b903df7602cf586e499b45Phill Cunningtonpublic final class InvalidRealmNameManager {
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington /**
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * Set of forbidden realm names due to clashes with REST endpoints or other reasons.
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington */
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington private static final Set<String> INVALID_REALM_NAMES = new CopyOnWriteArraySet<String>();
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington private InvalidRealmNameManager() {
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington //Private utility constructor.
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington }
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington /**
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * Returns a <em>mutable</em> set of realm names that should be black-listed to prevent conflicts with REST
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * endpoints or other functionality. The returned set can be safely modified from concurrent threads.
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington *
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington * @return the set of invalid realm names.
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington */
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington public static Set<String> getInvalidRealmNames() {
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington return INVALID_REALM_NAMES;
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington }
a093731116a8c24d49b903df7602cf586e499b45Phill Cunnington}