Examples of BasicAuthentication


Examples of org.apache.oodt.cas.protocol.auth.BasicAuthentication

    gMail.setUser("bfoster@google.com", "password");
    gMail.start();
    ImapsProtocol.port = gMail.getImaps().getPort();
    imapsProtocol = new ImapsProtocol();
    try {
      imapsProtocol.connect("localhost", new BasicAuthentication("bfoster@google.com", "password"));
    } catch (ProtocolException e) {
      fail("Failed to connect to GreenMail IMAPS server : " + e.getMessage());
    }
    assertEquals(1, ImapsProtocol.connectCalls);
  }
View Full Code Here

Examples of org.apache.oodt.cas.protocol.auth.BasicAuthentication

   }

   private Authentication getAuthentication(URI uri) {
      if (uri.getUserInfo() != null) {
         String[] userInfo = uri.getUserInfo().split("\\:");
         return new BasicAuthentication(userInfo[0], userInfo[1]);
      } else {
         return new NoAuthentication();
      }
   }
View Full Code Here

Examples of org.apache.oodt.cas.protocol.auth.BasicAuthentication

  }
 
  public void testLSandCDandPWD() throws ProtocolException {

        CogJGlobusFtpProtocol ftpProtocol = spy(new CogJGlobusFtpProtocol(PORT));
        BasicAuthentication auth = new BasicAuthentication("anonymous", "password");

        /** Mocking server responses to prevent server failure **/

        Mockito.doReturn("testdata").when(ftpProtocol).getCurentDir();

View Full Code Here

Examples of org.apache.oodt.cas.protocol.auth.BasicAuthentication

   public Authentication getAuthentication() {
      if (user == null || pass == null) {
         return new NoAuthentication();
      } else {
         return new BasicAuthentication(user, pass);
      }
   }
View Full Code Here

Examples of org.apache.oodt.cas.protocol.auth.BasicAuthentication

        }

        // try connecting Protocol
        protocol.connect(
            remoteSite.getURL().getHost(),
            new BasicAuthentication(remoteSite.getUsername(), remoteSite
                .getPassword()));

        // check connection
        if (protocol.connected()
            && (!test || isOkProtocol(protocol, remoteSite))) {
View Full Code Here

Examples of org.apache.oodt.cas.protocol.auth.BasicAuthentication

    server.stop();
  }
 
  public void testLSandCDandPWD() throws ProtocolException {
    CogJGlobusFtpProtocol ftpProtocol = new CogJGlobusFtpProtocol(PORT);
    ftpProtocol.connect("localhost", new BasicAuthentication("anonymous", "password"));
    ftpProtocol.cd(new ProtocolFile("testdata", true));
    List<ProtocolFile> lsResults = ftpProtocol.ls();
    assertTrue(lsResults.contains(new ProtocolFile(ftpProtocol.pwd(), "users.properties", false)));
  }
View Full Code Here

Examples of org.apache.oodt.cas.protocol.auth.BasicAuthentication

        }

        // try connecting Protocol
        protocol.connect(
            remoteSite.getURL().getHost(),
            new BasicAuthentication(remoteSite.getUsername(), remoteSite
                .getPassword()));

        // check connection
        if (protocol.connected()
            && (!test || isOkProtocol(protocol, remoteSite))) {
View Full Code Here

Examples of org.apache.pivot.web.BasicAuthentication

    final static int PORT = 8080;
    final static boolean SECURE = false;

    @Test
    public void basicTest() throws SerializationException {
        final BasicAuthentication authentication = new BasicAuthentication("foo", "bar");

        TaskGroup queryGroup = new TaskGroup();

        // GET
        final GetQuery getQuery = new GetQuery(HOSTNAME, PORT, PATH, SECURE);
        getQuery.getParameters().put("a", "b");
        getQuery.setSerializer(new BinarySerializer());
        getQuery.getRequestHeaders().add("bar", "hello");
        getQuery.getRequestHeaders().add("bar", "world");
        authentication.authenticate(getQuery);
        queryGroup.add(getQuery);

        // POST
        final PostQuery postQuery = new PostQuery(HOSTNAME, PORT, PATH, SECURE);
        authentication.authenticate(postQuery);
        postQuery.setValue(JSONSerializer.parseList("[1, 2, 3]"));
        queryGroup.add(postQuery);

        // PUT
        final PutQuery putQuery = new PutQuery(HOSTNAME, PORT, PATH, SECURE);
        authentication.authenticate(putQuery);
        putQuery.setValue(JSONSerializer.parseMap("{a:100, b:200, c:300}"));
        queryGroup.add(putQuery);

        // POST
        final DeleteQuery deleteQuery = new DeleteQuery(HOSTNAME, PORT, PATH, SECURE);
        authentication.authenticate(deleteQuery);
        queryGroup.add(deleteQuery);

        queryGroup.execute(new TaskListener<Void>() {
            @SuppressWarnings("unchecked")
            @Override
View Full Code Here

Examples of org.eclipse.jetty.client.security.BasicAuthentication

    CumulocityLongPollingTransport(Map<String, Object> options, HttpClient httpClient, PlatformParameters paramters) {
        super(options, httpClient);
        this.paramters = paramters;
        try {
            this.authentication = new BasicAuthentication(new PlatformPropertiesRealm(paramters));
        } catch (IOException e) {
            throw new SDKException("authentication failed", e);
        }
    }
View Full Code Here

Examples of org.eclipse.jetty.client.security.BasicAuthentication

  }

  @Override
  public void setBasicAuthorization(final String username, final String password) {
    try {
      BasicAuthentication auth = new BasicAuthentication(new Realm() {     
        @Override public String getPrincipal() { return username; }
        @Override public String getId() { return null; }
        @Override public String getCredentials() { return password; }
      });
     
      // The Jetty Client uses the ISO-8859-1 char-set for Basic Authentication,
      // the same as the Jetty Server. See
      // https://github.com/eclipse/jetty.project/blob/master/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/BasicAuthenticator.java
      auth.setCredentials(exchange);
    } catch (IOException e) {
      // This happens only in the highly unlikely case that ISO-8859-1 would not be supported.
      // (BasicAuthentication should throw a RuntimeException in this case, instead of propagating a checked exception).
      // BasicAuthentication.setCredentials doesn't actually throw an IOException.
      throw new RuntimeException(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.