Skip to main content

rustfs_iam/federation/
error.rs

1// Copyright 2024 RustFS Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15pub type Result<T> = core::result::Result<T, FederationError>;
16
17#[derive(Debug, thiserror::Error)]
18pub enum FederatedSessionBindingError {
19    #[error("{0}")]
20    InvalidRequest(String),
21    #[error("{0}")]
22    Internal(String),
23}
24
25#[derive(Debug, thiserror::Error)]
26pub enum FederationError {
27    #[error("{0}")]
28    Authorization(String),
29    #[error("{0}")]
30    CodeExchange(String),
31    #[error("{0}")]
32    TokenVerification(String),
33    #[error("{0}")]
34    Logout(String),
35    #[error("no policies are available for this OIDC token")]
36    NoAuthorizationContext,
37    #[error(transparent)]
38    Binding(#[from] FederatedSessionBindingError),
39}