Friday, May 29, 2020

Password less schema account and proxy user authenticatoin

Create password-less user:

create user donghua3 no authentication;
grant create session, create table, unlimited tablespace to donghua3;
create table donghua3.t (id number);
insert into donghua3.t values(1);
commit;


SQL> col username for a20
SQL> select username,authentication_type from dba_users where username like 'DONGHUA3%';

USERNAME             AUTHENTI
-------------------- --------
DONGHUA3_CONNECT     PASSWORD
DONGHUA3             NONE


Create proxy user

create user donghua3_connect identified by NeverGuexx1;
alter user donghua3 grant connect through donghua3_connect;
-- alter user donghua3 revoke connect through donghua3_connect;
select * from proxy_users;


PROXY                   CLIENT    AUT FLAGS                              
----------------------- --------- --- -----------------------------------
DONGHUA3_CONNECT        DONGHUA3  NO  PROXY MAY ACTIVATE ALL CLIENT ROLES




[oracle@db19c ~]$ sqlplus donghua3_connect[donghua3]/NeverGuexx1@apppdb1

SQL*Plus: Release 19.0.0.0.0 - Production on Fri May 29 11:40:21 2020
Version 19.7.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.7.0.0.0


SQL> show user;
USER is "DONGHUA3"

SQL> select * from t;

        ID
----------
         1
         
SQL> select sys_context('userenv','session_user') from dual;

SYS_CONTEXT('USERENV','SESSION_USER')
--------------------------------------------------------------------------------
DONGHUA3

SQL> select sys_context('userenv','proxy_user') from dual;

SYS_CONTEXT('USERENV','PROXY_USER')
--------------------------------------------------------------------------------
DONGHUA3_CONNECT


No comments:

Post a Comment