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 * Preparation result for a signed response to an IdP-initiated logout request.
023 *
024 * @since 1.0.0
025 */
026@Immutable
027public sealed interface SamlLogoutResponsePostResult permits
028        SamlLogoutResponsePostResult.Prepared, SamlLogoutResponsePostResult.Rejected,
029        SamlLogoutResponsePostResult.Unavailable {
030    /**
031     * A signed LogoutResponse POST form.
032     *
033     * @since 1.0.0
034     */
035    @Immutable
036    final class Prepared implements SamlLogoutResponsePostResult {
037        private final @NonNull SamlPostForm postForm;
038        Prepared(@NonNull SamlPostForm postForm) { this.postForm = postForm; }
039        /**
040         * Returns the signed IdP POST form.
041         *
042         * @return prepared form
043         * @since 1.0.0
044         */
045        public @NonNull SamlPostForm getPostForm() { return postForm; }
046    }
047    /**
048     * Request or IdP connection did not match this SP.
049     *
050     * @since 1.0.0
051     */
052    @Immutable
053    enum Rejected implements SamlLogoutResponsePostResult {
054        /** No response was prepared. */ INSTANCE
055    }
056    /**
057     * Clock, randomness or signing failed.
058     *
059     * @since 1.0.0
060     */
061    @Immutable
062    enum Unavailable implements SamlLogoutResponsePostResult {
063        /** No response was prepared. */ INSTANCE
064    }
065}