Class UsernameProvider
java.lang.Object
org.eclipse.milo.opcua.sdk.client.identity.UsernameProvider
- All Implemented Interfaces:
IdentityProvider
-
Constructor Summary
ConstructorsConstructorDescriptionUsernameProvider(String username, String password) Construct aUsernameProviderthat does not validate the remote certificate and selects the first availableUserTokenPolicywithUserTokenType.UserName.UsernameProvider(String username, String password, org.eclipse.milo.opcua.stack.core.security.CertificateValidator certificateValidator) Construct aUsernameProviderthat validates the remote certificate usingcertificateValidatorand selects the first availableUserTokenPolicywithUserTokenType.UserName.UsernameProvider(String username, String password, org.eclipse.milo.opcua.stack.core.security.CertificateValidator certificateValidator, Function<List<org.eclipse.milo.opcua.stack.core.types.structured.UserTokenPolicy>, org.eclipse.milo.opcua.stack.core.types.structured.UserTokenPolicy> policyChooser) Construct aUsernameProviderthat validates the remote certificate usingcertificateValidatorand selects taUserTokenPolicyusingpolicyChooser.UsernameProvider(String username, Supplier<byte[]> passwordSupplier) Construct aUsernameProviderthat does not validate the remote certificate and selects the first availableUserTokenPolicywithUserTokenType.UserName.UsernameProvider(String username, Supplier<byte[]> passwordSupplier, org.eclipse.milo.opcua.stack.core.security.CertificateValidator certificateValidator) Construct aUsernameProviderthat validates the remote certificate usingcertificateValidatorand selects the first availableUserTokenPolicywithUserTokenType.UserName.UsernameProvider(String username, Supplier<byte[]> passwordSupplier, org.eclipse.milo.opcua.stack.core.security.CertificateValidator certificateValidator, Function<List<org.eclipse.milo.opcua.stack.core.types.structured.UserTokenPolicy>, org.eclipse.milo.opcua.stack.core.types.structured.UserTokenPolicy> policyChooser) Construct aUsernameProviderthat validates the remote certificate usingcertificateValidatorand selects taUserTokenPolicyusingpolicyChooser. -
Method Summary
Modifier and TypeMethodDescriptiongetIdentityToken(org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription endpoint, org.eclipse.milo.opcua.stack.core.types.builtin.ByteString serverNonce) Return theUserIdentityTokenandSignatureData(if applicable for the token) to use when activating a session.toString()
-
Constructor Details
-
UsernameProvider
Construct aUsernameProviderthat does not validate the remote certificate and selects the first availableUserTokenPolicywithUserTokenType.UserName.- Parameters:
username- the username to authenticate with.password- the password to authenticate with.
-
UsernameProvider
public UsernameProvider(String username, String password, org.eclipse.milo.opcua.stack.core.security.CertificateValidator certificateValidator) Construct aUsernameProviderthat validates the remote certificate usingcertificateValidatorand selects the first availableUserTokenPolicywithUserTokenType.UserName.- Parameters:
username- the username to authenticate with.password- the password to authenticate with.certificateValidator- theCertificateValidatorused to validate the remote certificate.
-
UsernameProvider
public UsernameProvider(String username, String password, org.eclipse.milo.opcua.stack.core.security.CertificateValidator certificateValidator, Function<List<org.eclipse.milo.opcua.stack.core.types.structured.UserTokenPolicy>, org.eclipse.milo.opcua.stack.core.types.structured.UserTokenPolicy> policyChooser) Construct aUsernameProviderthat validates the remote certificate usingcertificateValidatorand selects taUserTokenPolicyusingpolicyChooser.Useful if the server might return more than one
UserTokenPolicywithUserTokenType.UserName.- Parameters:
username- the username to authenticate with.password- the password to authenticate with.certificateValidator- theCertificateValidatorused to validate the remote certificate.policyChooser- a function that selects aUserTokenPolicyto use. The policy list is guaranteed to be non-null and non-empty.
-
UsernameProvider
Construct aUsernameProviderthat does not validate the remote certificate and selects the first availableUserTokenPolicywithUserTokenType.UserName.- Parameters:
username- the username to authenticate with.passwordSupplier- a supplier providing the password bytes. The supplied byte[] will be zeroed out after being retrieved and used.
-
UsernameProvider
public UsernameProvider(String username, Supplier<byte[]> passwordSupplier, org.eclipse.milo.opcua.stack.core.security.CertificateValidator certificateValidator) Construct aUsernameProviderthat validates the remote certificate usingcertificateValidatorand selects the first availableUserTokenPolicywithUserTokenType.UserName.- Parameters:
username- the username to authenticate with.passwordSupplier- a supplier providing the password bytes. The supplied byte[] will be zeroed out after being retrieved and used.certificateValidator- theCertificateValidatorused to validate the remote certificate.
-
UsernameProvider
public UsernameProvider(String username, Supplier<byte[]> passwordSupplier, org.eclipse.milo.opcua.stack.core.security.CertificateValidator certificateValidator, Function<List<org.eclipse.milo.opcua.stack.core.types.structured.UserTokenPolicy>, org.eclipse.milo.opcua.stack.core.types.structured.UserTokenPolicy> policyChooser) Construct aUsernameProviderthat validates the remote certificate usingcertificateValidatorand selects taUserTokenPolicyusingpolicyChooser.Useful if the server might return more than one
UserTokenPolicywithUserTokenType.UserName.- Parameters:
username- the username to authenticate with.passwordSupplier- a supplier providing the password bytes. The supplied byte[] will be zeroed out after being retrieved and used.certificateValidator- theCertificateValidatorused to validate the remote certificate.policyChooser- a function that selects aUserTokenPolicyto use. The policy list is guaranteed to be non-null and non-empty.
-
-
Method Details
-
getIdentityToken
public SignedIdentityToken getIdentityToken(org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription endpoint, org.eclipse.milo.opcua.stack.core.types.builtin.ByteString serverNonce) throws Exception Description copied from interface:IdentityProviderReturn theUserIdentityTokenandSignatureData(if applicable for the token) to use when activating a session.- Specified by:
getIdentityTokenin interfaceIdentityProvider- Parameters:
endpoint- theEndpointDescriptionbeing connected to.- Returns:
- a
SignedIdentityTokencontaining theUserIdentityTokenandSignatureData. - Throws:
Exception
-
toString
-