Search in sources :

Example 1 with AnonymousIdentityToken

use of org.eclipse.milo.opcua.stack.core.types.structured.AnonymousIdentityToken in project milo by eclipse.

the class AnonymousProviderTest method testGetIdentityToken_EmptyPolicyId.

@Test
public void testGetIdentityToken_EmptyPolicyId() throws Exception {
    EndpointDescription endpoint = new EndpointDescription(null, null, null, null, null, new UserTokenPolicy[] { new UserTokenPolicy("", UserTokenType.Anonymous, null, null, null) }, null, null);
    AnonymousProvider p = new AnonymousProvider();
    SignedIdentityToken signedIdentityToken = p.getIdentityToken(endpoint, ByteString.NULL_VALUE);
    assertEquals(signedIdentityToken.getToken().getPolicyId(), "");
    assertTrue(signedIdentityToken.getToken() instanceof AnonymousIdentityToken);
}
Also used : AnonymousIdentityToken(org.eclipse.milo.opcua.stack.core.types.structured.AnonymousIdentityToken) EndpointDescription(org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription) UserTokenPolicy(org.eclipse.milo.opcua.stack.core.types.structured.UserTokenPolicy) Test(org.testng.annotations.Test)

Example 2 with AnonymousIdentityToken

use of org.eclipse.milo.opcua.stack.core.types.structured.AnonymousIdentityToken in project milo by eclipse.

the class AnonymousProviderTest method testGetIdentityToken.

@Test
public void testGetIdentityToken() throws Exception {
    EndpointDescription endpoint = new EndpointDescription(null, null, null, null, null, new UserTokenPolicy[] { new UserTokenPolicy("anonymous", UserTokenType.Anonymous, null, null, null) }, null, null);
    AnonymousProvider p = new AnonymousProvider();
    SignedIdentityToken signedIdentityToken = p.getIdentityToken(endpoint, ByteString.NULL_VALUE);
    assertEquals(signedIdentityToken.getToken().getPolicyId(), "anonymous");
    assertTrue(signedIdentityToken.getToken() instanceof AnonymousIdentityToken);
}
Also used : AnonymousIdentityToken(org.eclipse.milo.opcua.stack.core.types.structured.AnonymousIdentityToken) EndpointDescription(org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription) UserTokenPolicy(org.eclipse.milo.opcua.stack.core.types.structured.UserTokenPolicy) Test(org.testng.annotations.Test)

Example 3 with AnonymousIdentityToken

use of org.eclipse.milo.opcua.stack.core.types.structured.AnonymousIdentityToken in project milo by eclipse.

the class AnonymousProviderTest method testGetIdentityToken_NullPolicyId.

@Test
public void testGetIdentityToken_NullPolicyId() throws Exception {
    EndpointDescription endpoint = new EndpointDescription(null, null, null, null, null, new UserTokenPolicy[] { new UserTokenPolicy(null, UserTokenType.Anonymous, null, null, null) }, null, null);
    AnonymousProvider p = new AnonymousProvider();
    SignedIdentityToken signedIdentityToken = p.getIdentityToken(endpoint, ByteString.NULL_VALUE);
    assertNull(signedIdentityToken.getToken().getPolicyId());
    assertTrue(signedIdentityToken.getToken() instanceof AnonymousIdentityToken);
}
Also used : AnonymousIdentityToken(org.eclipse.milo.opcua.stack.core.types.structured.AnonymousIdentityToken) EndpointDescription(org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription) UserTokenPolicy(org.eclipse.milo.opcua.stack.core.types.structured.UserTokenPolicy) Test(org.testng.annotations.Test)

Aggregations

AnonymousIdentityToken (org.eclipse.milo.opcua.stack.core.types.structured.AnonymousIdentityToken)3 EndpointDescription (org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription)3 UserTokenPolicy (org.eclipse.milo.opcua.stack.core.types.structured.UserTokenPolicy)3 Test (org.testng.annotations.Test)3