Package org.w3c.www.http

Examples of org.w3c.www.http.HttpCredential


    public void actionPerformed(ActionEvent ae) {
  if( ae.getActionCommand().equals("Ok") ||
      ae.getSource().equals(passwd)) {
      if(!user.getText().equals("")) {
    HttpCredential credential;
    credential = HttpFactory.makeCredential("Basic");
    Base64Encoder encoder = new Base64Encoder(user.getText()
                +":"
                                                          +passwd.getText());
    credential.setAuthParameter("cookie", encoder.processString());
    sb.admin.setCredential(credential);
    sb.dispose(true);
    done();
      } else {
    // popup an Error? FIXME
View Full Code Here


    }

    BasicAuthContext (Request request)
  throws BasicAuthContextException, ProtocolException
    {
  HttpCredential credential = null;

  credential = (request.isProxy()
          ? request.getProxyAuthorization()
          : request.getAuthorization());
  if ( ! credential.getScheme().equalsIgnoreCase("Basic") ) {
      String msg = ("Invalid authentication scheme \""
        + credential.getScheme()
        + " expecting \"Basic\"");
      throw new BasicAuthContextException (msg) ;
  }
  // Decode the credentials:
  String decoded = null ;
  this.cookie    = credential.getAuthParameter("cookie");
  try {
      Base64Decoder b  = new Base64Decoder (cookie) ;
      decoded          = b.processString() ;
  } catch (Base64FormatException e) {
      String msg = "Invalid BASE64 encoding of credentials." ;
View Full Code Here

          String algo)
  throws InvalidAuthException
    {
  super(request, algo);
  this.request = request;
  HttpCredential credential = (request.isProxy()
             ? request.getProxyAuthorization()
             : request.getAuthorization());
  if ((credential == null) ||
      ( ! credential.getScheme().equalsIgnoreCase("Digest"))) {
      no_user = true;
  } else {
      no_user        = false;
      dac_user       = credential.getAuthParameter("username");
      dac_uri        = credential.getAuthParameter("uri");
      dac_response   = credential.getAuthParameter("response");
      dac_realm      = credential.getAuthParameter("realm");
      dac_method     = request.getMethod();
      dac_nonce      = credential.getAuthParameter("nonce");
      dac_opaque     = credential.getAuthParameter("opaque");
      dac_cnonce     = credential.getAuthParameter("cnonce");
      dac_nc         = credential.getAuthParameter("nc");
      dac_qop        = credential.getAuthParameter("qop");
      if (dac_qop == null) {
    dac_qop = "auth";
      } else {
    if (!dac_qop.equals("auth")) {
        String msg = "qop value not supported";
View Full Code Here

             String old_nonce,
             String algo)
  throws InvalidAuthException
    {
  super(request);
  HttpCredential credential = (request.isProxy()
             ? request.getProxyAuthorization()
             : request.getAuthorization());
  if ((credential == null) ||
      ( ! credential.getScheme().equalsIgnoreCase("Digest"))) {
      no_user = true;
  } else {
      no_user        = false;
      dac_user       = credential.getAuthParameter("username");
      dac_uri        = credential.getAuthParameter("uri");
      dac_response   = credential.getAuthParameter("response");
      dac_realm      = credential.getAuthParameter("realm");
      dac_method     = request.getMethod();
      dac_nonce      = credential.getAuthParameter("nonce");
      this.nonce     = nonce;
      this.old_nonce = old_nonce;
      this.algo      = algo;
      if (dac_user == null || dac_uri == null || dac_response == null ||
    dac_realm == null) {
View Full Code Here

  // maybe not as it implies session tracking

  DigestAuthContext (Request request)
      throws DigestAuthFilterException, ProtocolException
  {
      HttpCredential credential = null;
     
      credential = (request.isProxy()
        ? request.getProxyAuthorization()
        : request.getAuthorization());
      if ( ! credential.getScheme().equalsIgnoreCase("Digest") ) {
    String msg = ("Invalid authentication scheme \""
            + credential.getScheme()
            + " expecting \"Digest\"");
    throw new DigestAuthFilterException (msg) ;
      }
      // now split things and decode things
      dac_user     = credential.getAuthParameter("username");
      dac_uri      = credential.getAuthParameter("uri");
      dac_response = credential.getAuthParameter("response");
      dac_realm    = credential.getAuthParameter("realm");
      dac_method   = request.getMethod();
      dac_nonce    = credential.getAuthParameter("nonce");
      if (dac_user == null || dac_uri == null || dac_response == null ||
    dac_realm == null) {
    String msg = ("Invalid authentication header");
    throw new DigestAuthFilterException(msg);
      }
View Full Code Here

     */
    public JigKill( URL adminURL, String username, String password )
  throws RemoteAccessException
    {
        AdminContext   ctxt       = new AdminContext( adminURL );
        HttpCredential credential = HttpFactory.makeCredential( "Basic" );
        Base64Encoder  encoder    = new Base64Encoder( username + ":" +
                   password );

        credential.setAuthParameter( "cookie", encoder.processString() );
        ctxt.setCredential( credential );
        ctxt.initialize();       

        adminServer = ctxt.getAdminResource();
        ctrls       = getControls( adminServer );
View Full Code Here

  // Is this really for us to catch ?
  if ((reply.getStatus() != HTTP.UNAUTHORIZED)
      && (reply.getStatus() != HTTP.PROXY_AUTH_REQUIRED))
      return null;
  // Do we know about this realm ?
  HttpCredential credentials = null;
  if ((credentials = lookupRealm(request, reply)) == null) {
      // If we can't interact, we can't help:
      if ( ! request.getAllowUserInteraction() )
    return null;
      // Great ! Now we can indeed help:
      PasswordPrompter prompter = new PasswordPrompter(request, reply);
      if ( ! prompter.prompt() )
    return null;
      String user     = prompter.getUser();
      String password = prompter.getPassword();
      // Compute credentials:
      credentials = HttpFactory.makeCredential("Basic");
      Base64Encoder encoder = new Base64Encoder(user+":"+password);
      credentials.setAuthParameter("cookie", encoder.processString());
  }
  // Now restart the request we the right auth infos:
  if ( request.hasProxy() )
      request.setProxyAuthorization(credentials);
  else
View Full Code Here

TOP

Related Classes of org.w3c.www.http.HttpCredential

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.