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