Policy Manager API Returns Exception When Testing With a Policy Domain that protects a root URL (Doc ID 980938.1)

Last updated on SEPTEMBER 21, 2016

Applies to:

COREid Access - Version: 10.1.4.0.1 to 10.1.4.2 - Release: 10g to 10g
Information in this document applies to any platform.

Symptoms

-- Problem Statement:

When using the Policy Manager API, an exception is returned when testing a policy that protects the root URL "/" .
This is happens when trying to run the Sample code " AccessManagerSamples.java" which located under ASDK_install_Dir\AccessServerSDK\samples and only running Example-5 from it.

For example:
test.setURL("myhost.mydomain.com/"); will return the following exception

"ObAMException: Access Test contains an invalid URL."


However, test.setURL("myhost.mydomain.com/abc.html"); is working  fine.

Note:  There's a policy domain created to protect the root URL "/" and it's working fine from the browser.
and validated through Access Tester.

Below is a copy for the Example(5) source code while using the root URL:

 static void example5(ObAccessManager am) throws ObAMException
    {
        System.out.println();
        System.out.println("EXAMPLE 5");

        ObAMAccessTest test = new ObAMAccessTest();
        ObAMIdentity person1 = new ObAMIdentity();
        //ObAMIdentity person2 = new ObAMIdentity();

        test.setResourceType("http");
        test.setURL("host.domain.com/");       --> Notice the "/" at the end.
        test.addOperation("GET");
        test.addOperation("POST");
        //test.setIPaddress("192.168.1.14");
        ObAMDate date = new ObAMDate();
        ObAMTime time = new ObAMTime();
        date.set(2001, ObAMDate.NOVEMBER, 15);
        time.set(12, 0, 0);
        test.setDate(date);
        test.setTime(time);

        person1.setLoginID("user_name");
        //person2.setLoginID("J.Himes");
        test.addUser(person1);
        //test.addUser(person2);

        test.setShowAllowed(true);
        test.setShowDenied(true);
        test.setShowMatchingPolicy(true);
        test.setShowMatchingExpr(true);
        test.setShowDeterminingRules(true);

        ObAMAccessTestResults results = am.testAccess(test);
        System.out.println("Policy Domain : " + results.getPolicyDomain());
        for (int i = 0; i < results.getNumberOfResults(); i++) {
            ObAMAccessTestResult result = results.getResult(i);
            System.out.println("Result:");
            System.out.println("   User       : " + result.getUser().getUID());

            if ( result.getAuthorized() == true )
            {
                System.out.println("   Authorized : ALLOWED");
            }
            else
            {
                if ( result.getAuthorizationStatus() == ObAMAccessTestResult.DENIED )
                {
                    System.out.println("   Authorized : DENIED");
                }
                else if ( result.getAuthorizationStatus() == ObAMAccessTestResult.INCONCLUSIVE )
                {
                    System.out.println("   Authorized : INCONCLUSIVE");
                }
                else
                {
                    System.out.println("   Authorized : ERROR");
                }
            }

            System.out.println("   Policy     : " + result.getPolicy());
            System.out.println("   Expr       : " + result.getExpr());

            System.out.println("   Determining Rules: ");
            for ( int j=0; j<result.getNumberOfDeterminingRules(); j++ )
            {
                System.out.println("                      " + result.getDeterminingRule(j)) ;
            }
           
            System.out.println("   Redirect Url       : " + result.getRedirectUrl());
        }
    }

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms