为什么我的身份验证不起作用? (顶尖)

时间:2013-02-21 14:58:33

标签: authentication login oracle-apex

我有一个功能来验证我的用户,这是因为我测试了它。

验证功能:

create or replace function authenticate(p_username in VARCHAR2, p_password in VARCHAR2) 
return BOOLEAN 
is 
  l_password varchar2(4000); 
  l_stored_password varchar2(4000); 
  l_count number; 
begin 
select count(*) into l_count from users where username = p_username; 
if l_count > 0 then 
  -- First, we fetch the stored hashed password
  select password into l_stored_password 
   from users where upper(username) = upper(p_username); 
    -- we have to apply the custom hash function to the password 
    l_password := custom_hash(p_username, p_password); 
    -- Finally, we compare them to see if they are the same and return
    -- either TRUE or FALSE
    if l_password = l_stored_password then 
      return true; 
    else 
      return false; 
    end if; 
else 
  -- The username provided is not in the users table
  return false; 
end if; 
end; 

然而我在Apex中的身份验证不起作用,我激活了身份验证方案并链接到身份验证功能。 我正在使用apex 4.2

1 个答案:

答案 0 :(得分:1)

这就是我的设置方法:

方案类型:自定义
验证功能名称:my_auth_func
来源:

FUNCTION my_auth_func (p_username IN VARCHAR2, p_password IN VARCHAR2)
RETURN BOOLEAN
IS
    is_authenticated BOOLEAN := FALSE;
BEGIN
    --authentication logic, etc...
    RETURN is_authenticated;
END