How to create a CSP Login Page and control user sessions

CSP, Caché

How to create a CSP Login Page and control user sessions?

  • 0
  • 0
  • 350
  • 10
  • 2

Answers

 If (%session.NewSession = 1) {
    // this is a new session
 }

 

Set %session.Data("MyData") = 22 Write $Get(%session.Data("MyData")) // this should print 22 

 

 

 

to create your own Login Page you best start with  Class  %CSP.Login and adapt it to your specific needs.

defaulting to

and then you add the new Login Page to Security-> WebApplications

 

adapt :== create your own class and inherit %CSP.Login

Works, but customize ?

change Look & feel ?

i try override any method and gets 404

you better not change   %CSP.Login but make a personal copy and change this

404 = HTTP page not found. Most likely you put your copy to the wrong directory or namespace   

And then you have to put the reference in MgmtPortal Security-> WebApplications as Login page:
Again with the correct namespace and the correct directory.

A few weird things with custom login pages:

CSPSystem needs read permission on the DB containing them. (You'll need to close CSPGateway connections after making this change so that it can reconnect with the right privileges.)

It's specified with the ".cls" extension in the web application configuration, not just the classname.

best solution to my problem look like stupid solution :

In my case : i need a custom home page, look no cache system (Custom Logo, Custom Form)

my solution :

1.- create a simple index.html with a login form (Action page is my App Home)
2.- put this file in web app folder

3.- Set "Login Page" to my index.html

Bingo !

i so sad, this history never end ...

this solution have no interaction with login failure, some ideas ??

Name the file login.csp

And inside it check for Error:ErrorCode request parameter:

<html><head><title>Login</title></head>
<body>
My login page:</br>
<form method='post'>
Name: <input name="CacheUserName"/><br/>
Password: <input type='password' name="CachePassword"/><br/>
<input type='submit'/>
</form>

<server>
Set tMsg = $Get(%request.Data("Error:ErrorCode",1))
    If ((tMsg'="")&&($SYSTEM.Status.GetErrorCodes(tMsg)'[$$$ERRORCODE($$$RequireAuthentication))) {
        &html<<center>>
        write "Auth failed!"
        &html<</center>>
    }
</server>
</body>
</html>

i forget something ...

file exist, but :

Not Found

The requested URL /csp/user/index.csp was not found on this server.

If you have index.csp and it is specified as login page and you are seeing 404 error, try following:

a) Enable Audit
b) Enable Protect event in Audit
c) Reproduce the problem.
e) Check Audit records if any Protect errors were logged

Comments