Package io.micronaut.security.endpoints
Class LogoutController
java.lang.Object
io.micronaut.security.endpoints.LogoutController
@Requires(property="micronaut.security.endpoints.logout.enabled",notEquals="false",defaultValue="true") @Requires(classes=io.micronaut.http.annotation.Controller.class) @Requires(beans=LogoutHandler.class)
@Controller("${micronaut.security.endpoints.logout.path:/logout}")
@Secured("isAnonymous()")
public class LogoutController
extends Object
- Since:
- 1.0
- Author:
- Sergio del Amo
-
Constructor Summary
ConstructorDescriptionLogoutController
(LogoutHandler<io.micronaut.http.HttpRequest<?>, io.micronaut.http.MutableHttpResponse<?>> logoutHandler, io.micronaut.context.event.ApplicationEventPublisher<LogoutEvent> logoutEventPublisher, LogoutControllerConfiguration logoutControllerConfiguration) Deprecated, for removal: This API element is subject to removal in a future version.LogoutController
(LogoutHandler<io.micronaut.http.HttpRequest<?>, io.micronaut.http.MutableHttpResponse<?>> logoutHandler, io.micronaut.context.event.ApplicationEventPublisher<LogoutEvent> logoutEventPublisher, LogoutControllerConfiguration logoutControllerConfiguration, io.micronaut.http.server.util.HttpHostResolver httpHostResolver, io.micronaut.http.server.util.locale.HttpLocaleResolver httpLocaleResolver) -
Method Summary
Modifier and TypeMethodDescriptionprotected io.micronaut.http.MutableHttpResponse<?>
handleLogout
(io.micronaut.http.HttpRequest<?> request, @Nullable Authentication authentication) io.micronaut.http.MutableHttpResponse<?>
index
(io.micronaut.http.HttpRequest<?> request, @Nullable Authentication authentication) POST endpoint for Logout Controller.io.micronaut.http.MutableHttpResponse<?>
indexGet
(io.micronaut.http.HttpRequest<?> request, @Nullable Authentication authentication) GET endpoint for Logout Controller.
-
Constructor Details
-
LogoutController
@Inject public LogoutController(LogoutHandler<io.micronaut.http.HttpRequest<?>, io.micronaut.http.MutableHttpResponse<?>> logoutHandler, io.micronaut.context.event.ApplicationEventPublisher<LogoutEvent> logoutEventPublisher, LogoutControllerConfiguration logoutControllerConfiguration, io.micronaut.http.server.util.HttpHostResolver httpHostResolver, io.micronaut.http.server.util.locale.HttpLocaleResolver httpLocaleResolver) - Parameters:
logoutHandler
- A collaborator which helps to build HTTP response if user logout.logoutEventPublisher
- The application event publisherlogoutControllerConfiguration
- Configuration for the Logout controllerhttpHostResolver
- The http host resolverhttpLocaleResolver
- The http locale resolver- Since:
- 4.7.0
-
LogoutController
@Deprecated(forRemoval=true, since="4.7.0") public LogoutController(LogoutHandler<io.micronaut.http.HttpRequest<?>, io.micronaut.http.MutableHttpResponse<?>> logoutHandler, io.micronaut.context.event.ApplicationEventPublisher<LogoutEvent> logoutEventPublisher, LogoutControllerConfiguration logoutControllerConfiguration) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
logoutHandler
- A collaborator which helps to build HTTP response if user logout.logoutEventPublisher
- The application event publisherlogoutControllerConfiguration
- Configuration for the Logout controller
-
-
Method Details
-
index
@Consumes({"application/x-www-form-urlencoded","application/json"}) @Post public io.micronaut.http.MutableHttpResponse<?> index(io.micronaut.http.HttpRequest<?> request, @Nullable @Nullable Authentication authentication) POST endpoint for Logout Controller.- Parameters:
request
- TheHttpRequest
being executedauthentication
-Authentication
instance for current user- Returns:
- An AccessRefreshToken encapsulated in the HttpResponse or a failure indicated by the HTTP status
-
indexGet
@Get public io.micronaut.http.MutableHttpResponse<?> indexGet(io.micronaut.http.HttpRequest<?> request, @Nullable @Nullable Authentication authentication) GET endpoint for Logout Controller.- Parameters:
request
- TheHttpRequest
being executedauthentication
-Authentication
instance for current user- Returns:
- An AccessRefreshToken encapsulated in the HttpResponse or a failure indicated by the HTTP status
-
handleLogout
protected io.micronaut.http.MutableHttpResponse<?> handleLogout(io.micronaut.http.HttpRequest<?> request, @Nullable @Nullable Authentication authentication) - Parameters:
request
- TheHttpRequest
being executedauthentication
-Authentication
instance for current user- Returns:
- An AccessRefreshToken encapsulated in the HttpResponse or a failure indicated by the HTTP status
-
LogoutController(LogoutHandler, ApplicationEventPublisher, LogoutControllerConfiguration, HttpHostResolver, HttpLocaleResolver)
instead