001/*
002 * Copyright 2026 Revetware LLC.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package com.revetsec.saml;
017
018import org.jspecify.annotations.NonNull;
019import javax.annotation.concurrent.Immutable;
020
021/**
022 * Result of bounded raw-query HTTP-Redirect binding parsing.
023 *
024 * @since 1.0.0
025 */
026@Immutable
027public sealed interface SamlRedirectBindingParseResult permits
028        SamlRedirectBindingParseResult.Parsed, SamlRedirectBindingParseResult.Rejected {
029    /**
030     * A parsed but not yet verified Redirect message.
031     *
032     * @since 1.0.0
033     */
034    @Immutable
035    final class Parsed implements SamlRedirectBindingParseResult {
036        private final @NonNull SamlRedirectBindingMessage message;
037        Parsed(@NonNull SamlRedirectBindingMessage message) { this.message = message; }
038        /**
039         * Returns the message for signature and semantic validation.
040         *
041         * @return unverified message
042         * @since 1.0.0
043         */
044        public @NonNull SamlRedirectBindingMessage getMessage() { return message; }
045    }
046    /**
047     * Malformed, duplicate, oversized or unsigned query input.
048     *
049     * @since 1.0.0
050     */
051    @Immutable
052    enum Rejected implements SamlRedirectBindingParseResult {
053        /** No message is released. */ INSTANCE
054    }
055}