Skip to main content
David Lopez
Participating Frequently
Jan 31, 2023 5:01 AM UTC

U2 token Auth and UOPY

Hello 

is token auth supported for UOPY ??? 

Can't seem to make it work. It's invalid login all the time. OS User logins O.K. 

My token : 
TOKEN_DEF_BEGIN
TokenType=2
TokenId=dlopez@TESTSITE
TokenPass=*not shown*
OSUserId=dlopez
AllowedServices=UVCS,UVSERVER
Members=*quiter
Domains=
TOKEN_DEF_END

My code: 
import uopy

print(uopy.config.connection)

with uopy.connect(user='dlopez@TESTSITE', password='xxxxxxxx'):
    cmd = uopy.Command("LIST VOC")
    cmd.run()
    print(cmd.response)

My client config : 
[connection]
host = ec2-18-100-159-141.eu-south-2.compute.amazonaws.com
account = TEST1
port = 31438
timeout = 100
service = uvcs
ssl = False
encoding=iso-8859-1

[ssl_auth]
server_cert_file="c:\\temp\\desktop-ppdt4ds.crt"

[pooling]
pooling_on = False
max_wait_time = 60
idle_remove_threshold = 300
idle_remove_interval = 300
min_pool_size = 5
max_pool_size = 15

[logging]
level = DEBUG
backup_count = 10
log_data_max_size = 256

------------------------------
David Ricardo Lopez Bonaechea
Director of Software Strategy
Quiter Servicios Informaticos SL
Santander ES
------------------------------

    2 replies

    David Lopez
    Participating Frequently
    Jan 31, 2023 5:31 AM UTC
    Hello 

    is token auth supported for UOPY ??? 

    Can't seem to make it work. It's invalid login all the time. OS User logins O.K. 

    My token : 
    TOKEN_DEF_BEGIN
    TokenType=2
    TokenId=dlopez@TESTSITE
    TokenPass=*not shown*
    OSUserId=dlopez
    AllowedServices=UVCS,UVSERVER
    Members=*quiter
    Domains=
    TOKEN_DEF_END

    My code: 
    import uopy

    print(uopy.config.connection)

    with uopy.connect(user='dlopez@TESTSITE', password='xxxxxxxx'):
        cmd = uopy.Command("LIST VOC")
        cmd.run()
        print(cmd.response)

    My client config : 
    [connection]
    host = ec2-18-100-159-141.eu-south-2.compute.amazonaws.com
    account = TEST1
    port = 31438
    timeout = 100
    service = uvcs
    ssl = False
    encoding=iso-8859-1

    [ssl_auth]
    server_cert_file="c:\\temp\\desktop-ppdt4ds.crt"

    [pooling]
    pooling_on = False
    max_wait_time = 60
    idle_remove_threshold = 300
    idle_remove_interval = 300
    min_pool_size = 5
    max_pool_size = 15

    [logging]
    level = DEBUG
    backup_count = 10
    log_data_max_size = 256

    ------------------------------
    David Ricardo Lopez Bonaechea
    Director of Software Strategy
    Quiter Servicios Informaticos SL
    Santander ES
    ------------------------------
    Well something I am doing wrong, since java won't let me either 

    my code: 
    import asjava.uniobjects.UniSession;
    import asjava.uniobjects.UniSessionException;
    
    public class TestToken {
         public static void main(String[] args) {
              UniSession s = new UniSession();
              s.setUserName("dlopez@TESTSITE");
              s.setPassword("c1rolina");
              s.setHostName("ec2-18-100-159-141.eu-south-2.compute.amazonaws.com");
              s.setAccountPath("TEST1");
              try {
                   s.connect();
              } catch (Exception err) {
                   err.printStackTrace();
              } finally {
                   try {
                        s.disconnect();
                   } catch (UniSessionException e) {
    
                        e.printStackTrace();
                   }
              }
         }
    }​

    My Token (modified) : 

    1 token record read from wallet
    
    Version=1
    TimeCreated=Tue Jan 31 09:14:26 2023
    TimeModified=Tue Jan 31 09:16:19 2023
    
    TokenId=dlopez@TESTSITE
    TokenPass=*not shown*
    OSUserId=dlopez
    AllowedServices=
    Members=
    Domains=
    
    ​


    ------------------------------
    David Ricardo Lopez Bonaechea
    Director of Software Strategy
    Quiter Servicios Informaticos SL
    Santander ES
    ------------------------------
    David Lopez
    Participating Frequently
    Jan 31, 2023 5:40 AM UTC
    Well something I am doing wrong, since java won't let me either 

    my code: 
    import asjava.uniobjects.UniSession;
    import asjava.uniobjects.UniSessionException;
    
    public class TestToken {
         public static void main(String[] args) {
              UniSession s = new UniSession();
              s.setUserName("dlopez@TESTSITE");
              s.setPassword("c1rolina");
              s.setHostName("ec2-18-100-159-141.eu-south-2.compute.amazonaws.com");
              s.setAccountPath("TEST1");
              try {
                   s.connect();
              } catch (Exception err) {
                   err.printStackTrace();
              } finally {
                   try {
                        s.disconnect();
                   } catch (UniSessionException e) {
    
                        e.printStackTrace();
                   }
              }
         }
    }​

    My Token (modified) : 

    1 token record read from wallet
    
    Version=1
    TimeCreated=Tue Jan 31 09:14:26 2023
    TimeModified=Tue Jan 31 09:16:19 2023
    
    TokenId=dlopez@TESTSITE
    TokenPass=*not shown*
    OSUserId=dlopez
    AllowedServices=
    Members=
    Domains=
    
    ​


    ------------------------------
    David Ricardo Lopez Bonaechea
    Director of Software Strategy
    Quiter Servicios Informaticos SL
    Santander ES
    ------------------------------
    Note to myself

    I am an idiot. Read documentation  carefully 

    Token was badly constructed .

    New token, all working : 

    oot@ip-172-31-9-63 bin]# ./credman -list 
    1 token record read from wallet
    
    Version=1
    TimeCreated=Tue Jan 31 09:14:26 2023
    TimeModified=Tue Jan 31 10:36:07 2023
    
    TokenId=MAINSITE
    TokenPass=*not shown*
    OSUserId=dlopez
    AllowedServices=
    Members=*quiter
    Domains=
    ​


    ------------------------------
    David Ricardo Lopez Bonaechea
    Director of Software Strategy
    Quiter Servicios Informaticos SL
    Santander ES
    ------------------------------