Statistics
| Revision:

gvsig-projects-pool / org.gvsig.online / trunk / org.gvsig.online / org.gvsig.online.swing / org.gvsig.online.swing.scribejava / src / main / java / org / gvsig / online / swing / scribejava / keycloak / callbacks / CallbackLogoutHandler.java @ 9514

History | View | Annotate | Download (1.55 KB)

1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.online.swing.scribejava.keycloak.callbacks;
7

    
8
import com.github.scribejava.core.oauth.OAuth20Service;
9
import com.sun.net.httpserver.HttpExchange;
10
import com.sun.net.httpserver.HttpHandler;
11
import java.io.IOException;
12
import java.io.OutputStream;
13
import org.gvsig.online.swing.scribejava.keycloak.UserIdentificationKeycloak;
14

    
15
/**
16
 *
17
 * @author jjdelcerro
18
 */
19
@SuppressWarnings("UseSpecificCatch")
20
public class CallbackLogoutHandler extends AbstractCallback implements HttpHandler {
21
    
22
    public CallbackLogoutHandler(UserIdentificationKeycloak identificationRequester, OAuth20Service service, String contextPath) {
23
        super(identificationRequester, service, contextPath);
24
    }
25

    
26
    @Override
27
    public void handle(HttpExchange t) throws IOException {
28
        String requestURL = "Unknown";
29
        try {
30
            requestURL = t.getRequestURI().toString();
31
//            LOGGER.info("Callback logout "+requestURL);
32
            response(t, 200, message_and_close("logout\n"+t.getRequestURI().toString()+"\n"));
33
        } catch (Exception ex) {
34
            LOGGER.warn("Can't process callback authorization (contextPath '" + contextPath + "', request URL '" + requestURL + "')", ex);
35
            responseQuietly(t, 500, message("Can't authenticate user<br>\n" + ex.getMessage()));
36
        } finally {
37
            this.stopWaitingForResponse();
38
        }
39
    }
40
    
41
    
42
}