Examples of defining trusted locations

These trusted-context examples show how to define trusted locations by using the ADDRESS attribute.

Example 1: Using an IPv4 address

In this example, trusted-context object tcx1 grants user newton a trusted connection if the request comes from the IPv4 address 192.0.2.1.

CREATE TRUSTED CONTEXT tcx1
  USER newton
  ATTRIBUTES (ADDRESS '192.0.2.1')
  ENABLE;

Example 2: Using an IPv6 address

In this example, trusted-context object tcx2 grants user brock a trusted connection if the request comes from the IPv6 address 2001:0DB8:0000:0000:0008:0800:200C:417A.

CREATE TRUSTED CONTEXT tcx2
  USER brock
  ATTRIBUTES (ADDRESS '2001:0DB8:0000:0000:0008:0800:200C:417A')
  ENABLE;
Tip: You can use the compressed form of the IPv6 address: 2001:DB8::8:800:200C:417A.

Example 3: Using a secure domain name

In this example, trusted-context object tcx3 grants user hayes a trusted connection if the request comes from the secure corona.testlab.ibm.com domain.

CREATE TRUSTED CONTEXT tcx3
  USER hayes
  ATTRIBUTES (ADDRESS 'corona.testlab.ibm.com')
  ENABLE;

Example 4: Defining multiple trusted locations in a single trusted-context object

In this example, trusted-context object tcx4 grants user newton a trusted connection if the request comes from the IPv4 address 192.0.2.1, the IPv4 address 194.0.6.3, or the secure corona.testlab.ibm.com domain.

CREATE TRUSTED CONTEXT tcx4
  USER newton
  ATTRIBUTES (ADDRESS '192.0.2.1',
              ADDRESS '194.0.6.3',
              ADDRESS 'corona.testlab.ibm.com')
  ENABLE;