简体   繁体   中英

GSS-API Kerberos Authentication

Im trying to create a application that can authenticate a user using kerberos ticket. I dont know how can i proceed with this. i have wrote some code to get spengo token from header and then extract the kerberos token from it. but i receive only a null spengo token. im running my application on the same server that the active directory is set up.

here is the method that im using to get spnego token

private byte[] getSPNEGOTokenFromHTTPRequest(HttpServletRequest req) {

    byte[] spnegoToken = null;

    if (req != null) {

        String header = req.getHeader("Authorization");

        if ((header != null) && header.startsWith("Negotiate")) {

            header = header.substring("Negotiate".length()).trim();

            try {
                spnegoToken = Base64.decode(header);
            } catch (Exception e) {
                e.printStackTrace();
                //todo
            }
        }
    }
    return spnegoToken;
}

Can any one help me with this or tell me what im doing wrong here

不要浪费时间,请使用库: http : //tomcatspnegoad.sourceforge.net/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM