Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'd be happy to help you if you could explain a bit more clearly what you want to do and what currently isn't working. (What you are trying to accomplish with the application, What you have so far for authentication, and what exactly you are stuck on.)</p> <p>If you want to start from scratch, this is what you'd do:</p> <ul> <li><p>Use the "DataSnap Server" wizard to create a new server project. This will use Indy (Instead of WebBroker) and will allow for TCP/IP connections. (even for Heavyweight callbacks.)</p></li> <li><p>While setting the properties in the wizard, make sure to check the "Authentication" option ("Authorization" isn't required. Only if you want a more complicated authentication/authorization mechanism.)</p></li> <li><p>Open the ServerModule unit the wizard generated, and switch to the code tab</p></li> <li><p>Find the "DSAuthenticationManager1UserAuthenticate" function (added automatically if you checked Authentication in the wizard.)</p></li> <li><p>In this function, do your authentication... you have access to the user name ("User") and password ("Password"). Connect to a database, and see if there is a matching user, and what roles the user has. Then, populate the UserRoles collection passed in to this method with all the roles the user has.</p></li> <li><p>Once you specify roles on a user, those do nothing until your server methods also have allowed or denied roles assigned to them. You can do this in the TDSAuthenticationManager component at design time in the Object Inspector. (ServerModule form). There is a Roles collection you can modify.</p></li> <li><p>Or, you can add attributes in code to your server methods. You can put this for example:</p> <pre><code>[TRoleAuth('admin')] function EchoString(String: Value): String; </code></pre></li> </ul> <p>That will mean EchoString can only be invoked by a user with the 'admin' role.</p> <p>Or this:</p> <pre><code>[TRoleAuth('', 'admin')] function EchoString(String: Value): String; </code></pre> <p>Which would mean anyone EXCEPT a user with the 'admin' role can invoke EchoString.</p> <p>Or this:</p> <pre><code>[TRoleAuth('admin,guest,visitor')] function EchoString(String: Value): String; </code></pre> <p>Which would mean any user with 'admin', 'guest', or 'visitor' as one of their roles (or any combination) can invoke EchoString.</p> <p>NOTE: To use the TRoleAuth attribute, you need to add the DSAuth unit to your uses clause, otherwise the role attributes will be ignored.</p> <p>On the client, add a TSQLConnection component. Set the driver to "Datasnap" then expand it. Set the host and port values. See more on setting this up here:</p> <p><a href="http://blogs.embarcadero.com/mathewd/2011/07/12/programmatically-set-datasnap-credentials-on-a-tsqlconnection/" rel="nofollow">http://blogs.embarcadero.com/mathewd/2011/07/12/programmatically-set-datasnap-credentials-on-a-tsqlconnection/</a></p> <p>Also, I've previously posted on my blog about authentication: <a href="http://blogs.embarcadero.com/mathewd/2010/09/12/authentication-and-authorization-with-datasnap-and-rest/" rel="nofollow">http://blogs.embarcadero.com/mathewd/2010/09/12/authentication-and-authorization-with-datasnap-and-rest/</a></p> <p>I hope that helps.</p> <p>Mat</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload