src/com/isode/stroke/sasl/ClientAuthenticator.java
author Da Risk <da_risk@beem-project.com>
Wed, 06 Mar 2013 22:15:45 +0100
changeset 1029 3c02bfd5c885
parent 1018 8daca77fabc1
permissions -rw-r--r--
Update chinese translation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1015
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
     1
/*
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
     2
 * Copyright (c) 2010, Isode Limited, London, England.
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
     3
 * All rights reserved.
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
     4
 */
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
     5
/*
1018
8daca77fabc1 fix Remko's currly part of name
Jiří Pinkava <j-pi@seznam.cz>
parents: 1015
diff changeset
     6
 * Copyright (c) 2010, Remko Tronçon.
1015
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
     7
 * All rights reserved.
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
     8
 */
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
     9
package com.isode.stroke.sasl;
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    10
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    11
import com.isode.stroke.base.ByteArray;
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    12
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    13
public abstract class ClientAuthenticator {
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    14
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    15
    public ClientAuthenticator(String name) {
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    16
        this.name = name;
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    17
    }
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    18
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    19
    public String getName() {
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    20
        return name;
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    21
    }
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    22
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    23
    public void setCredentials(String authcid, String password) {
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    24
        setCredentials(authcid, password, "");
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    25
    }
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    26
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    27
    public void setCredentials(String authcid, String password, String authzid) {
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    28
        this.authcid = authcid;
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    29
        this.password = password;
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    30
        this.authzid = authzid;
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    31
    }
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    32
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    33
    public abstract ByteArray getResponse();
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    34
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    35
    public abstract boolean setChallenge(ByteArray challenge);
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    36
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    37
    public String getAuthenticationID() {
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    38
        return authcid;
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    39
    }
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    40
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    41
    public String getAuthorizationID() {
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    42
        return authzid;
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    43
    }
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    44
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    45
    public String getPassword() {
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    46
        return password;
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    47
    }
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    48
    private String name;
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    49
    private String authcid;
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    50
    private String password;
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    51
    private String authzid;
63669480c941 Add an implementation of the SCRAM-SHA-! SASL mechanism.
Da Risk <da_risk@beem-project.com>
parents:
diff changeset
    52
}