oracle password_verify_function,使用PASSWORD_VERIFY_FUNCTION设置用户密码复杂度

本文介绍了如何使用Oracle的PASSWORD_VERIFY_FUNCTION来设置用户密码的复杂度要求,包括最小长度、字符类型等。通过创建一个验证函数并将其设置在用户profile中,确保密码符合设定的规则。当尝试创建不符合规则的用户时,系统将返回错误提示。
摘要由CSDN通过智能技术生成

依据PASSWORD_VERIFY_FUNCTION可以设置oracle用户的密码复杂度,比如密码长度>=10,必须包含字母/数字等

首先需要创建一个密码验证的function,然后设置profile的PASSWORD_VERIFY_FUNCTION即可

SQL> select TEXT from dba_source where NAME='VERIFY_JUSTIN_USER';

TEXT

------------------------------------------------------------------------------------------------------------------------------------

FUNCTION verify_JUSTIN_user (  username VARCHAR2,

password VARCHAR2,

old_password varchar2 )

RETURN boolean

IS

passwordMinLength   INTEGER;

passwordLength      INTEGER;

differ              INTEGER;

differMinLength     INTEGER;

isDigit             BOOLEAN;

isChar              BOOLEAN;

isPunct             BOOLEAN;

digitArray          VARCHAR2(20);

punctArray          VARCHAR2(25);

charArray           VARCHAR2(52);

BEGIN

digitArray         := '0123456789';

charArray          := 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

punctArray         := '!"#$%&()``*+,-/:;<=>?_';

passwordMinLength  := 10;

differMinLength    := 2;--HAD-1

passwordLength     := LENGTH(password);

isDigit            := FALSE;

isChar             := FALSE;

isPunct            := FALSE;

-- +------------------------------------------------+

-- | Check if the password is same as the username  |

-- +------------------------------------------------+

In Oracle, the PASSWORD_VERIFY_FUNCTION is a built-in function that allows you to enforce password complexity rules and policies when creating or altering user passwords. It helps to ensure that passwords meet certain requirements and enhances the security of the Oracle database. By default, Oracle provides a default password verification function called "ORA12C_STRONG_VERIFY_FUNCTION". This function enforces the following password complexity rules: 1. The password must be at least 8 characters long. 2. It must contain at least one uppercase letter. 3. It must contain at least one lowercase letter. 4. It must contain at least one numeric digit. 5. It must contain at least one special character (e.g., !@#$%^&*). You can view the details of this default password verification function by querying the DBA_USERS view: ```sql SELECT * FROM DBA_USERS; ``` To alter the password complexity rules or create a custom password verification function, you can use the DBMS_AUTHENTICATION package. Here's an example of how to create a custom password verification function in Oracle: ```sql CREATE OR REPLACE FUNCTION my_password_verify_function ( username IN VARCHAR2, password IN VARCHAR2, old_password IN VARCHAR2 ) RETURN BOOLEAN IS -- Custom password verification logic goes here BEGIN -- Return TRUE if the password meets the desired criteria, otherwise FALSE END; / ``` Once you have created your custom password verification function, you can set it as the current password verification function using the ALTER PROFILE statement: ```sql ALTER PROFILE my_profile LIMIT PASSWORD_VERIFY_FUNCTION my_password_verify_function; ``` This will enforce your custom password complexity rules for new passwords or when altering existing passwords for users associated with the specified profile. Remember to adjust the logic inside your custom password_verify_function to fit your specific requirements for password complexity and security.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值