package org.chenyang.http.impl.auth;

import org.chenyang.http.Header;
import org.chenyang.http.HttpRequest;
import org.chenyang.http.auth.AuthenticationException;
import org.chenyang.http.auth.Credentials;
import org.chenyang.http.protocol.HttpContext;
import org.chenyang.http.util.Args;
import org.ietf.jgss.GSSException;
import org.ietf.jgss.Oid;

public class SPNegoScheme extends GGSSchemeBase {
   private static final String SPNEGO_OID = "1.3.6.1.5.5.2";

   public SPNegoScheme(boolean stripPort, boolean useCanonicalHostname) {
      super(stripPort, useCanonicalHostname);
   }

   public SPNegoScheme(boolean stripPort) {
      super(stripPort);
   }

   public SPNegoScheme() {
   }

   public String getSchemeName() {
      return "Negotiate";
   }

   public Header authenticate(Credentials credentials, HttpRequest request, HttpContext context) throws AuthenticationException {
      return super.authenticate(credentials, request, context);
   }

   protected byte[] generateToken(byte[] input, String authServer) throws GSSException {
      return super.generateToken(input, authServer);
   }

   protected byte[] generateToken(byte[] input, String authServer, Credentials credentials) throws GSSException {
      return this.generateGSSToken(input, new Oid("1.3.6.1.5.5.2"), authServer, credentials);
   }

   public String getParameter(String name) {
      Args.notNull(name, "Parameter name");
      return null;
   }

   public String getRealm() {
      return null;
   }

   public boolean isConnectionBased() {
      return true;
   }
}
