Please use the RoleUsersManager to get the roles of the user. The method acceptedCredentials contains just the data that was sent to the authentication layer to *verify* the credentials. This is not the same as all the data of the Account+

On 16-aug-05, at 16:09, F Baube wrote:

Surely sendmail reeled when thusly spake Geert Bevin:


No, these are the credentials that are submitted by the form.


Well, a form does not submit a role, it is Rife that decides
what role to pass to my authent class.  My point is only that
Rife passes _only_ the role that has been specified for access
to the Element that is being protected, and it can pass no role
at all.


If you want to know which roles an account is in, you have
to look is up through the RoleUsersManager.


Yup !  Clip-n-save:

    public static List<String> getRolesByUser(String login) {

    final ArrayList AL = new ArrayList<String>();
    assert (login != null);
    assert (login.length() != 0);
    MemoryUsers MU = (MemoryUsers) MemoryUsers.getRepInstance());
    try {
        MU.listUserRoles(login, new ListRoles() {
             public boolean foundRole(String role) {
            AL.add(role); return (true); }
        });
    } catch (CredentialsManagerException cme) {
        return (null);
    }
    return (AL);
    }

fred



If you don't specify any value for the role property in the
authenticated element declaration, any valid user can login.


So it seems.  Altho this also means that when

   MemoryAuthenticated.acceptedCredentials(Credentials creds)

is called, there is no value for "role" in the Credentials,
since none was required.

   class MyAuth extends MemoryAuthenticated {

       protected void acceptedCredentials(Credentials C) {

       RoleUserCredentials RUC = (RoleUserCredentials) C;
       login = RUC.getLogin();
       paswd = RUC.getPassword();
       role  = RUC.getRole(); // returns (null)
       [..]




--
Geert Bevin                       Uwyn bvba
"Use what you need"               Avenue de Scailmont 34
http://www.uwyn.com               7170 Manage
gbevin[remove] at uwyn dot com    Tel +32 64 84 80 03

PGP Fingerprint : 4E21 6399 CD9E A384 6619  719A C8F4 D40D 309F D6A9
Public PGP key  : available at servers pgp.mit.edu, wwwkeys.pgp.net

_______________________________________________
Rife-users mailing list
[email protected]
http://www.uwyn.com/mailman/listinfo/rife-users

Reply via email to