Package org.linphone.core
Interface AuthInfo
public interface AuthInfo
Object holding authentication information.
In most case, authentication information consists of a username and password.
If realm isn't set, it will be deduced automatically from the first
authentication challenge as for the hash algorithm. Sometimes, a userid is
required by the proxy and then domain can be useful to discriminate different
credentials. You can also use this object if you need to use a client
certificate.
Once created and filled, a
in order to become known and used automatically when needed. Use
for that purpose.
The
information when needed to the application through the
authentication_requested() callback of it's
The application can respond to this information request later using
. This will unblock all pending authentication transactions and retry them with
authentication headers.
In most case, authentication information consists of a username and password.
If realm isn't set, it will be deduced automatically from the first
authentication challenge as for the hash algorithm. Sometimes, a userid is
required by the proxy and then domain can be useful to discriminate different
credentials. You can also use this object if you need to use a client
certificate.
Once created and filled, a
AuthInfo
must be added to the Core
in order to become known and used automatically when needed. Use
Core.addAuthInfo(org.linphone.core.AuthInfo)
for that purpose.
The
Core
object can take the initiative to request authenticationinformation when needed to the application through the
authentication_requested() callback of it's
CoreListener
.The application can respond to this information request later using
Core.addAuthInfo(org.linphone.core.AuthInfo)
. This will unblock all pending authentication transactions and retry them with
authentication headers.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAvailableAlgorithm
(String algorithm) Add an unique algorithm in the the available algorithms list : Algorithms that
already exist will not be added.void
Remove all algorithms from the available algorithms list.clone()
Instantiates a new auth info with values from source.Return a previously set access token.Gets the algorithm.Get the previously set authorization server uri.String[]
Gets all available algorithms.Get the previously set OAUTH2 client_id.Get the previously set OAUTH2 client_secret.Gets the domain.long
Get the expiration time for the current authentication information.getHa1()
Gets the ha1.long
Gets the native pointer used by this class to make native method calls.Gets the password.getRealm()
Gets the realm.Return a previously set refresh token.Gets the TLS certificate.Gets the TLS certificate path.Gets the TLS key.Gets the TLS key path.Get the previously set token endpoint https uri (OAUTH2).Gets the object stored in this object user's dataGets the user id.Gets the username.boolean
isEqualButAlgorithms
(AuthInfo authInfo2) Check if Authinfos are the same without taking account algorithms.void
setAccessToken
(BearerToken token) Set an access token to authenticate, to be used when the server supports the
"bearer" authentication method.void
setAlgorithm
(String algorithm) Sets the algorithm to use.void
Set the authorization server uri.void
setAvailableAlgorithms
(String[] algorithms) Sets the available algorithms list without testing unicity.void
setClientId
(String clientId) Set the OAUTH2 client_id.void
setClientSecret
(String clientSecret) Set the OAUTH2 client_secret.void
Sets the domain for which this authentication is valid.void
setExpires
(long expires) Set the expiration time for the current authentication information.void
Sets the ha1.void
setPassword
(String password) Sets the password.void
Sets the realm.void
setRefreshToken
(BearerToken token) Set a refresh token to use when the access token set withsetAccessToken(org.linphone.core.BearerToken)
expires.void
setTlsCert
(String tlsCert) Sets the TLS certificate.void
setTlsCertPath
(String tlsCertPath) Sets the TLS certificate path.void
Sets the TLS key.void
setTlsKeyPath
(String tlsKeyPath) Sets the TLS key path.void
Set the token endpoint https uri (OAUTH2).void
setUserData
(Object data) Sets the object to store in this object user's datavoid
Sets the user ID.void
setUsername
(String username) Sets the username.toString()
-
Method Details
-
getAccessToken
Return a previously set access token.
- Returns:
- the access token, as a
BearerToken
object
-
setAccessToken
Set an access token to authenticate, to be used when the server supports the
"bearer" authentication method.
TheAuthInfo
takes a reference to the supplied token, it is not making
any copy.- Parameters:
token
- TheBearerToken
object representing the access token.
-
getAlgorithm
Gets the algorithm.
- Returns:
- The algorithm.
-
setAlgorithm
Sets the algorithm to use.
- Parameters:
algorithm
- The algorithm.
-
getAuthorizationServer
Get the previously set authorization server uri.
- Returns:
- the authorization server uri.
-
setAuthorizationServer
Set the authorization server uri.
- Parameters:
uri
- the authorization server uri.
-
getAvailableAlgorithms
Gets all available algorithms.
- Returns:
- A list of available algorithms.
-
setAvailableAlgorithms
Sets the available algorithms list without testing unicity.
- Parameters:
algorithms
- The available algorithms list.
-
getClientId
Get the previously set OAUTH2 client_id.
- Returns:
- the client_id.
-
setClientId
Set the OAUTH2 client_id.
The client_id may be used to renew access token from refresh token. If a
client_secret is required, it has to be set throughsetClientSecret(java.lang.String)
.
see:setRefreshToken(org.linphone.core.BearerToken)
- Parameters:
clientId
- the client_id.
-
getClientSecret
Get the previously set OAUTH2 client_secret.
- Returns:
- the client_secret.
-
setClientSecret
Set the OAUTH2 client_secret.
The client_secret may be used to renew access token from refresh token.
see:setRefreshToken(org.linphone.core.BearerToken)
- Parameters:
clientSecret
- the client_secret.
-
getDomain
Gets the domain.
- Returns:
- The domain.
-
setDomain
Sets the domain for which this authentication is valid.
- Parameters:
domain
- The domain. This should not be necessary because realm is
supposed to be unique and sufficient. However, many SIP servers don't set realm
correctly, then domain has to be used to distinguish between several SIP
account bearing the same username.
-
getExpires
long getExpires()Get the expiration time for the current authentication information.
- Returns:
- The expiration time as a number of seconds since the Epoch, 1970-01-01
00:00:00 +0000 (UTC)
-
setExpires
void setExpires(long expires) Set the expiration time for the current authentication information.
- Parameters:
expires
- The new expiration time in seconds. Use 0 to indicate no
expiration.
-
getHa1
Gets the ha1.
- Returns:
- The ha1.
-
setHa1
Sets the ha1.
- Parameters:
ha1
- The ha1.
-
getPassword
Gets the password.
- Returns:
- The password.
-
setPassword
Sets the password.
- Parameters:
password
- The password.
-
getRealm
Gets the realm.
- Returns:
- The realm.
-
setRealm
Sets the realm.
- Parameters:
realm
- The realm.
-
getRefreshToken
Return a previously set refresh token.
- Returns:
- the refresh token, as a
BearerToken
object.
-
setRefreshToken
Set a refresh token to use when the access token set withsetAccessToken(org.linphone.core.BearerToken)
expires.
TheAuthInfo
takes a reference to the supplied token, it is not making
any copy. Provided that the token endpoint uri was assigned withsetTokenEndpointUri(java.lang.String)
, once theAuthInfo
is pushed in theCore
,AuthInfo
object automatically obtains new access token when needed, from the supplied
refresh token.- Parameters:
token
- TheBearerToken
object representing the refresh token.
-
getTlsCert
Gets the TLS certificate.
- Returns:
- The TLS certificate.
-
setTlsCert
Sets the TLS certificate.
- Parameters:
tlsCert
- The TLS certificate.
-
getTlsCertPath
Gets the TLS certificate path.
- Returns:
- The TLS certificate path.
-
setTlsCertPath
Sets the TLS certificate path.
- Parameters:
tlsCertPath
- The TLS certificate path.
-
getTlsKey
Gets the TLS key.
- Returns:
- The TLS key.
-
setTlsKey
Sets the TLS key.
- Parameters:
tlsKey
- The TLS key.
-
getTlsKeyPath
Gets the TLS key path.
- Returns:
- The TLS key path.
-
setTlsKeyPath
Sets the TLS key path.
- Parameters:
tlsKeyPath
- The TLS key path.
-
getTokenEndpointUri
Get the previously set token endpoint https uri (OAUTH2).
- Returns:
- the token endpoint uri.
-
setTokenEndpointUri
Set the token endpoint https uri (OAUTH2).
The token endpoint uri is used to renew access token from refresh token. see:
setRefreshToken(org.linphone.core.BearerToken)
- Parameters:
uri
- the token endpoint uri.
-
getUserid
Gets the user id.
- Returns:
- The user id.
-
setUserid
Sets the user ID.
- Parameters:
userId
- The userid.
-
getUsername
Gets the username.
- Returns:
- The username.
-
setUsername
Sets the username.
- Parameters:
username
- The username.
-
addAvailableAlgorithm
Add an unique algorithm in the the available algorithms list : Algorithms that
already exist will not be added.
- Parameters:
algorithm
- The algorithm to add.
-
clearAvailableAlgorithms
void clearAvailableAlgorithms()Remove all algorithms from the available algorithms list.
-
clone
Instantiates a new auth info with values from source.
- Returns:
- The newly created
AuthInfo
object.
-
isEqualButAlgorithms
Check if Authinfos are the same without taking account algorithms.
- Parameters:
authInfo2
- The secondAuthInfo
object.- Returns:
- true if all fields (Username, UserId, Realm, Domain) are the same.
-
setUserData
Sets the object to store in this object user's data- Parameters:
data
- the object to store
-
getUserData
Object getUserData()Gets the object stored in this object user's data- Returns:
- the object store if any, null otherwise
-
getNativePointer
long getNativePointer()Gets the native pointer used by this class to make native method calls.- Returns:
- the nativer pointer, as long
-
toString
String toString()
-