1

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

认证功能:

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 中的身份验证不起作用,我激活了身份验证方案并链接到身份验证功能。我正在使用顶点 4.2

4

1 回答 1

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
于 2013-02-27T22:40:51.697 回答