4.2.10.3 Login to the Graph Server Using Kerberos Ticket

The following are the steps to login to the graph server (PGX) using Kerberos ticket:
  1. Create a new Kerberos ticket using the okinit command:
    $ okinit <username>

    This will prompt for your password and then create a new Kerberos ticket.

  2. Connect to a remote graph server with only the base URL parameter using JShell:
    $ opg4j -b https://localhost:7007
    Or using Python client:
    $ opg4py -b https://localhost:7007
    On Linux, JShell and Python interactive client shells automatically detect the Kerberos ticket on your local file system and use that to authenticate with the graph server.
  3. In case the auto-detection is not working, you can also explicitly pass in the ticket to the shell. Run the oklist command, to find the location of the ticket on the local file system.
    $ oklist
     
    Kerberos Utilities for Linux: Version 19.0.0.0.0 - Production on 31-MAR-2021 15:26:46
     
    Copyright (c) 1996, 2019 Oracle.  All rights reserved.
     
    Configuration file : /etc/krb5.conf.
    Ticket cache: FILE:/tmp/krb5cc_54321
    Default principal: oracle@realm
  4. Specify your Kerberos ticket path using the --kerberos_ticket parameter. For example, using JShell:
    $ opg4j -b https://localhost:7007 --kerberos_ticket /tmp/krb5cc_54321
    Or using Python Client:
    $ opg4py -b https://localhost:7007 --kerberos_ticket /tmp/krb5cc_54321

    If you are using a Java client program (or JShell on embedded mode), you can get a server instance using the following API:

    ...
    ServerInstance instance = GraphServer.getInstance("https://localhost:7007", "/tmp/krb5cc_54321");
    PgxSession session = instance.createSession("my-session");
    ...

    If you are using a Python Client program (or opg4py on embedded mode), you can get a server instance using the following API

    ...
    instance = graph_server.get_instance("https://localhost:7007", "/tmp/krb5cc_54321")
    session = instance.create_session("my-session")
    ...
    If you are connecting to a remote graph server, all you need is the Oracle Graph Client to be installed. For example:
    import sys
    import pypgx as pgx
     
    sys.path.append("/path/to/graph/client/oracle-graph-client-21.2.0/python/pypgx/pg/rdbms")
     
    import graph_server
      
    base_url = "https://localhost:7007"
    kerberos_ticket = "/tmp/krb5cc_54321"
      
    instance = graph_server.get_instance(base_url, kerberos_ticket)
    print(instance)