自定义架构中的APEX身份验证功能不起作用

时间:2014-08-15 12:47:56

标签: function login plsql authorization oracle-apex

在方案设置页面的登录处理部分,字段验证功能设置为AUTORYZACJA(功能名称)

字段注销网址:wwv_flow_custom_auth_std.logout?p_this_flow =& APP_ID。& p_next_flow_page_sess = 4155:PUBLIC_PAGE

这是我的功能:

create or replace FUNCTION AUTORYZACJA (p_username in VARCHAR2, p_password in VARCHAR2)
return BOOLEAN
is
v_pwd_baza varchar2(4000);
v_liczba number;
begin
select count(*) into v_liczba from UZYTKOWNICY where upper(login) = upper(p_username);
if v_liczba > 0 then
select password into v_pwd_baza from UZYTKOWNICY where upper(login) = upper(p_username);
if p_password = v_pwd_baza then
return true;
else
return false;
end if;
else
return false;
end if;
end;

使用此功能的架构登录不起作用。错误是“无效的登录凭据”。我不知道该怎么办。

我很感激你对这种情况的帮助。

2 个答案:

答案 0 :(得分:2)

您还应始终使用散列密码,不要以纯文本格式存储它们。 请参阅http://apexawy.blogspot.com.au/2011/07/custom-authentication-scheme.html

之类的内容

你收到的ora-06553是因为你试图在SQL中引用一个布尔值(返回值) - SQL没有意识到布尔值。您需要使用

之类的东西进行测试
begin
  if autoryzacja('login','password') then 
    dbms_output.put_line('true');
  else
    dbms_output.put_line('false');
  end if;
end;
/

答案 1 :(得分:1)

将调试日志记录添加到您的函数中。这应该会告诉您问题发生的位置。

如果您在apex 4.1中,请使用如下语句:

apex_debug_message.log_message('username is: ' || p_username || 
    ' and password is ' || p_password);

对于apex 4.2,请使用:

apex_debug.message('username is: ' || p_username || ' and password is ' 
  || p_password);

在函数开头的这样一个语句,加上每个你分配值的地方,每个地方都应该显示出错的地方。

然后在开发人员工具栏上单击“调试”并尝试登录。失败后单击查看调试,您应该在日志中看到调试消息。