public class SASLXOauth2Mechanism extends SASLMechanism
The given password will be used as OAUTH token.
Note that X-OAUTH2 is experimental in Smack. This is because Google defined, besides being a bad practice (XEP-134), custom attributes to the 'auth' stanza, as can be seen here
<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="X-OAUTH2"
auth:service="chromiumsync" auth:allow-generated-jid="true"
auth:client-uses-full-bind-result="true" xmlns:auth="http://www.google.com/talk/protocol/auth">
from https://developers.google.com/cloud-print/docs/rawxmpp and here
<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl"
mechanism="X-OAUTH2"
auth:service="oauth2"
xmlns:auth="http://www.google.com/talk/protocol/auth">
base64("\0" + user_name + "\0" + oauth_token)
</auth>
from https://developers.google.com/talk/jep_extensions/oauth
Those attribute extensions are currently not supported by Smack, and it's unclear how it affects authorization and how widely they are used.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
authenticationId, authorizationId, connection, connectionConfiguration, CRAMMD5, DIGESTMD5, EXTERNAL, GSSAPI, host, password, PLAIN, serviceName, sslSession
Constructor and Description |
---|
SASLXOauth2Mechanism() |
Modifier and Type | Method and Description |
---|---|
protected void |
authenticateInternal(javax.security.auth.callback.CallbackHandler cbh) |
void |
checkIfSuccessfulOrThrow() |
protected byte[] |
getAuthenticationText()
Should return the initial response of the SASL mechanism.
|
java.lang.String |
getName()
Returns the common name of the SASL mechanism.
|
int |
getPriority()
Get the priority of this SASL mechanism.
|
SASLXOauth2Mechanism |
newInstance() |
authenticate, authenticate, authenticateInternal, authzidSupported, challengeReceived, compareTo, evaluateChallenge, instanceForAuthentication, saslPrep, setSaslPrepTransformer, toBytes, toString
public static final java.lang.String NAME
public SASLXOauth2Mechanism()
protected void authenticateInternal(javax.security.auth.callback.CallbackHandler cbh) throws SmackException
authenticateInternal
in class SASLMechanism
SmackException
protected byte[] getAuthenticationText() throws SmackException
SASLMechanism
null
or an
empty array here.getAuthenticationText
in class SASLMechanism
SmackException
public java.lang.String getName()
SASLMechanism
getName
in class SASLMechanism
public int getPriority()
SASLMechanism
getPriority
in class SASLMechanism
public SASLXOauth2Mechanism newInstance()
newInstance
in class SASLMechanism
public void checkIfSuccessfulOrThrow() throws SmackException
checkIfSuccessfulOrThrow
in class SASLMechanism
SmackException