Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Log in page on APEX (4.0)
Log in page on APEX [message #551077] Sun, 15 April 2012 09:05 Go to next message
newprogrammerSQ
Messages: 48
Registered: April 2012
Member
Are there any guides on how to connect a custom made user table to the log in authentication?

So far log in is ok with Application username and password...
I have a user table which includes:
Username(PK)
Password
Name
Admin (Yes/No)...

If user is Admin they should be able to see user administration page... they can't if their not
Any help appreciated Smile
Re: Log in page on APEX [message #551081 is a reply to message #551077] Sun, 15 April 2012 09:43 Go to previous messageGo to next message
c_stenersen
Messages: 255
Registered: August 2007
Senior Member
Go to shared components. There you have a link to "authorization schemes" (under security). Create a new one there with for instance the name isAdmin. You use the "Exists SQL query" type, and in your query you just select from your user table to find the admins (by using :APP_USER). Then in your page properties under security you choose your new authorization scheme in the "authorization scheme" field, and that page is only accessible to people you selected from your table.

You can also find some more docs on this here: http://docs.oracle.com/cd/E14373_01/appdev.32/e13363/acl.htm#CHDDIBDE
Re: Log in page on APEX [message #551088 is a reply to message #551081] Sun, 15 April 2012 10:21 Go to previous messageGo to next message
newprogrammerSQ
Messages: 48
Registered: April 2012
Member
so far I have only created my user table.. the log in page only works with the application database name as default...

I need to create a new authentication scheme which authenticates from the table as well...
I'm guessing from the wizard (create new authentication scheme from scratch)... i need to select "Use my custom function to authenticate."... but what Do i need to type in this to authneticate from table? or is there something else i have to create before I create this scheme?

[Updated on: Sun, 15 April 2012 10:22]

Report message to a moderator

Re: Log in page on APEX [message #551132 is a reply to message #551088] Sun, 15 April 2012 15:12 Go to previous messageGo to next message
newprogrammerSQ
Messages: 48
Registered: April 2012
Member
ok just figured i need a function!

Im editing the sample application one and this is what i have come up with so far:


create or replace function helpdesk_auth (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 helpdesk_user where user_login = p_username;
if l_count > 0 then
select user_password
from helpdesk_user where user_login = p_username;
if l_password = l_stored_password then
return true;
else
return false;
end if;
else
return false;
end if;
else
return false;
end if;
end;​



However this doesn't work could someone correct that for me please?

helpdesk_user table has
user_login
user_password...

should i have to edit anything else? from the login page or anything?
Re: Log in page on APEX [message #551136 is a reply to message #551132] Sun, 15 April 2012 15:28 Go to previous messageGo to next message
newprogrammerSQ
Messages: 48
Registered: April 2012
Member
Error at line 20: PLS-00103: Encountered the symbol "" 
thats what error i get when running code
Re: Log in page on APEX [message #551139 is a reply to message #551136] Sun, 15 April 2012 16:40 Go to previous messageGo to next message
c_stenersen
Messages: 255
Registered: August 2007
Senior Member
First: since the code isn't formatted and has a bunch of ifs and elses nested together I'm not planning to find the syntax error which I guess is causing this message. But this function can be made simpler than what you have here. Read this: http://docs.oracle.com/cd/E14373_01/appdev.32/e13363/acl.htm#CHDDDFBD
Re: Log in page on APEX [message #551141 is a reply to message #551139] Sun, 15 April 2012 16:57 Go to previous message
newprogrammerSQ
Messages: 48
Registered: April 2012
Member
thank you very much Smile
Previous Topic: list of value items POP UP
Next Topic: authorization schemes not allowing any access to the page
Goto Forum:
  


Current Time: Thu Mar 28 18:48:21 CDT 2024