All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.cloud.security.servlet.TokenAuthenticationResult Maven / Gradle / Ivy

There is a newer version: 3.5.5
Show newest version
/**
 * SPDX-FileCopyrightText: 2018-2023 SAP SE or an SAP affiliate company and Cloud Security Client Java contributors
 * 

* SPDX-License-Identifier: Apache-2.0 */ package com.sap.cloud.security.servlet; import com.sap.cloud.security.token.Token; import javax.annotation.Nullable; import java.security.Principal; import java.util.Collection; import java.util.Collections; /** * Class that represents the result of the authentication check performed by a {@link TokenAuthenticator}. */ public interface TokenAuthenticationResult { /** * The token that was checked for authentication. * * @return the token. */ @Nullable Token getToken(); /** * The principal associated with the request. * * @return the principal. */ @Nullable Principal getPrincipal(); /** * The authentication scopes. Can be empty. * * @return the scopes as a list of strings. Returns empty collection by default. */ default Collection getScopes() { return Collections.emptyList(); } /** * @return false if a reason for "unauthenticated" is given. */ default boolean isAuthenticated() { return getUnauthenticatedReason().isEmpty(); } /** * If not authenticated, this returns the reason why as text. * * @return the textual description why the request was not authenticated. Empty string if authenticated. */ default String getUnauthenticatedReason() { return ""; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy