here the comments:

/**
     * Digest algorithm used in storing passwords in a non-plaintext format.
     * Valid values are those accepted for the algorithm name by the
     * MessageDigest class, or <code>null</code> if no digesting should
     * be performed.
     */
    protected String digest = null;

    /**
     * The encoding charset for the digest.
     */
    protected String digestEncoding = null;


then the usage is this one:

For the encoding, it should be in Charset.availableCharsets() aliases.

For the digest MessageDigest.getInstance(digest) should be ok.



- Romain


2012/5/15 José Luis Cetina <maxtorz...@gmail.com>

> Noup, here is my entire class:
>
> package com.test;
>
> import java.sql.Connection;
> import javax.naming.InitialContext;
> import javax.sql.DataSource;
>
> public class MyDataSourceRealm extends
> org.apache.catalina.realm.DataSourceRealm{
>
>    @Override
>    protected Connection open() {
>        System.out.println("Usando KxDataSourceRealm");
>        try{
>           return ((DataSource) new
>
> InitialContext().lookup("openejb:Resource/"+dataSourceName)).getConnection();
>        }
>        catch(Exception e){
>            e.printStackTrace();
>        }
>       return null;
>     }
> }
>
> 2012/5/15 Romain Manni-Bucau <rmannibu...@gmail.com>
>
> > Did you override the validation?
> > Le 15 mai 2012 22:32, "José Luis Cetina" <maxtorz...@gmail.com> a écrit
> :
> >
> > > This is my realm declaration:
> > >
> > > <Realm
> > >        className="com.test.MyDataSourceRealm"
> > >        dataSourceName="MyDataSource"
> > >        userTable=" userTable "
> > >        userNameCol=" userNameCol "
> > >        userCredCol=" userCredCol "
> > >        userRoleTable=" userRoleTable "
> > >        roleNameCol=" roleNameCol "
> > >        digest="SHA-256"
> > > />
> > >
> > > This work with SHA-256 and hex encoding password, but if i want to
> > explicit
> > > add the digestEncodig (digestEncoding="hexadecimal" or
> > digestEncoding="hex"
> > > or  digestEncoding="HEX")  like this:
> > >
> > > <Realm
> > >        className="com.test.MyDataSourceRealm"
> > >        dataSourceName="MyDataSource"
> > >        userTable=" userTable "
> > >        userNameCol=" userNameCol "
> > >        userCredCol=" userCredCol "
> > >        userRoleTable=" userRoleTable "
> > >        roleNameCol=" roleNameCol "
> > >        digest="SHA-256"
> > >       digestEncoding="hex"
> > > />
> > >
> > >
> > > I get:
> > >
> > > Severe: Illegal digestEncoding: hex
> > > java.io.UnsupportedEncodingException: the encoding [hex] is not
> supported
> > >
> > >
> > > I repeat if i ignore the  digestEncoding my password (in SHA-256
> > > hexadecimal) works with Realm, but i want to set explicit the
> > > digestEcondig, what value represent hexadecimal??
> > >
> > > I tried to use Base64  (digestEncoding) but says the same "NOT
> SUPPORTED"
> > >
> > >
> > > What digestEncodig values are permited??
> > >
> > >
> > > Thanks
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Reply via email to