@@ -0,0 +1,2277 @@
+/*%0A * Copyright 2020 Wultra s.r.o.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage io.getlime.security.powerauth.app.webflow.controller;%0A%0Aimport org.springframework.security.oauth2.provider.endpoint.FrameworkEndpoint;%0Aimport org.springframework.security.oauth2.provider.token.AuthorizationServerTokenServices;%0Aimport org.springframework.security.oauth2.provider.token.DefaultTokenServices;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RequestMethod;%0Aimport org.springframework.web.bind.annotation.ResponseBody;%0A%0Aimport javax.annotation.Resource;%0Aimport javax.servlet.http.HttpServletRequest;%0A%0A/**%0A * Controller extending the default OAuth 2.0 support in Spring Boot by additional token%0A * revocation method. See https://www.baeldung.com/logout-spring-security-oauth for details.%0A *%0A * @author Petr Dvorak, petr@wultra.com%0A */%0A@FrameworkEndpoint%0Apublic class OAuth2ExtensionsController %7B%0A%0A    private static final String OAUTH_AUTHORIZATION_HEADER = %22Authorization%22;%0A    private static final String OAUTH_BEARER_PREFIX = %22Bearer %22;%0A%0A    @Resource(name = %22tokenServices%22)%0A    AuthorizationServerTokenServices tokenServices;%0A%0A    @RequestMapping(value = %22/oauth/token%22, method = RequestMethod.DELETE)%0A    @ResponseBody%0A    public void revokeToken(HttpServletRequest request) %7B%0A        String authorization = request.getHeader(OAUTH_AUTHORIZATION_HEADER);%0A        if (authorization != null && authorization.startsWith(OAUTH_BEARER_PREFIX))%7B%0A            String tokenId = authorization.substring(OAUTH_BEARER_PREFIX.length());%0A            if (tokenServices instanceof DefaultTokenServices) %7B%0A                ((DefaultTokenServices)tokenServices).revokeToken(tokenId);%0A            %7D%0A        %7D%0A    %7D%0A%7D

Add DELETE /oauth/token method