[cas-user] Adding additional login field

2015-05-27 Thread Jonathan Bell
I am trying to add a third login field.  I am getting a message at login  
"Credentials you provided are not supported by cas" Something obviously I am 
missing in the modification. 

This is what I have done

I created a new credentials class, with new getter/setter methods that extends 
usernamepasswordcredentials. 

Modified login-webflow.xml and changed the var name credentials to my 
credentials class. 
added binding property for new field. 

modified loginview.jsp to display new field. 
-- 
You are currently subscribed to cas-user@lists.jasig.org as: 
arch...@mail-archive.com
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user


Re: [cas-user] Adding additional login field

2015-05-27 Thread Dmitriy Kopylenko
What version of CAS and which authentication handler do you use?

Dmitriy.

> On May 27, 2015, at 8:59 AM, Jonathan Bell  wrote:
> 
> I am trying to add a third login field.  I am getting a message at login  
> "Credentials you provided are not supported by cas" Something obviously I am 
> missing in the modification. 
> 
> This is what I have done
> 
> I created a new credentials class, with new getter/setter methods that 
> extends usernamepasswordcredentials. 
> 
> Modified login-webflow.xml and changed the var name credentials to my 
> credentials class. 
> added binding property for new field. 
> 
> modified loginview.jsp to display new field. 
> -- 
> You are currently subscribed to cas-user@lists.jasig.org as: 
> dkopyle...@unicon.net
> To unsubscribe, change settings or access archives, see 
> http://www.ja-sig.org/wiki/display/JSG/cas-user


-- 
You are currently subscribed to cas-user@lists.jasig.org as: 
arch...@mail-archive.com
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user



Re: [cas-user] Adding additional login field

2015-05-27 Thread Jonathan Bell

Sorry should have included that 3.5

jon

On 2015-05-27 6:11 AM, Dmitriy Kopylenko wrote:

What version of CAS and which authentication handler do you use?

Dmitriy.


On May 27, 2015, at 8:59 AM, Jonathan Bell  wrote:

I am trying to add a third login field.  I am getting a message at login  
"Credentials you provided are not supported by cas" Something obviously I am 
missing in the modification.

This is what I have done

I created a new credentials class, with new getter/setter methods that extends 
usernamepasswordcredentials.

Modified login-webflow.xml and changed the var name credentials to my 
credentials class.
added binding property for new field.

modified loginview.jsp to display new field.
--
You are currently subscribed to cas-user@lists.jasig.org as: 
dkopyle...@unicon.net
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user





--
You are currently subscribed to cas-user@lists.jasig.org as: 
arch...@mail-archive.com
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user


Re: [cas-user] Adding additional login field

2015-05-27 Thread Jonathan Bell
too quick on the enter. 
|org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler|

On 2015-05-27 6:11 AM, Dmitriy Kopylenko wrote:
> What version of CAS and which authentication handler do you use?
>
> Dmitriy.
>
>> On May 27, 2015, at 8:59 AM, Jonathan Bell  wrote:
>>
>> I am trying to add a third login field.  I am getting a message at login  
>> "Credentials you provided are not supported by cas" Something obviously I am 
>> missing in the modification.
>>
>> This is what I have done
>>
>> I created a new credentials class, with new getter/setter methods that 
>> extends usernamepasswordcredentials.
>>
>> Modified login-webflow.xml and changed the var name credentials to my 
>> credentials class.
>> added binding property for new field.
>>
>> modified loginview.jsp to display new field.
>> -- 
>> You are currently subscribed to cas-user@lists.jasig.org as: 
>> dkopyle...@unicon.net
>> To unsubscribe, change settings or access archives, see 
>> http://www.ja-sig.org/wiki/display/JSG/cas-user
>


-- 
You are currently subscribed to cas-user@lists.jasig.org as: 
arch...@mail-archive.com
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user


Re: [cas-user] Adding additional login field

2015-05-27 Thread Dmitriy Kopylenko
Seems like the authentication manager is failing to recognize your 
UsernamePasswordCredentials subclass by running this piece of code:

https://github.com/Jasig/cas/blob/v3.5.3/cas-server-core/src/main/java/org/jasig/cas/authentication/handler/support/AbstractUsernamePasswordAuthenticationHandler.java#L138
 


The goal here is to figure out why. I’d personally step through a debugger, as 
there are no useful log instrumentation in authentication manager impl., etc.

D.

> On May 27, 2015, at 9:16 AM, Jonathan Bell  wrote:
> 
> too quick on the enter. 
> org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler
> 
> On 2015-05-27 6:11 AM, Dmitriy Kopylenko wrote:
>> What version of CAS and which authentication handler do you use?
>> 
>> Dmitriy.
>> 
>>> On May 27, 2015, at 8:59 AM, Jonathan Bell  
>>>  wrote:
>>> 
>>> I am trying to add a third login field.  I am getting a message at login  
>>> "Credentials you provided are not supported by cas" Something obviously I 
>>> am missing in the modification. 
>>> 
>>> This is what I have done
>>> 
>>> I created a new credentials class, with new getter/setter methods that 
>>> extends usernamepasswordcredentials. 
>>> 
>>> Modified login-webflow.xml and changed the var name credentials to my 
>>> credentials class. 
>>> added binding property for new field. 
>>> 
>>> modified loginview.jsp to display new field. 
>>> -- 
>>> You are currently subscribed to cas-user@lists.jasig.org 
>>>  as: dkopyle...@unicon.net 
>>> 
>>> To unsubscribe, change settings or access archives, see 
>>> http://www.ja-sig.org/wiki/display/JSG/cas-user 
>>> 
>> 
> 
> -- 
> You are currently subscribed to cas-user@lists.jasig.org as: 
> dkopyle...@unicon.net
> To unsubscribe, change settings or access archives, see 
> http://www.ja-sig.org/wiki/display/JSG/cas-user


-- 
You are currently subscribed to cas-user@lists.jasig.org as: 
arch...@mail-archive.com
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Re: [cas-user] Adding additional login field

2015-05-27 Thread Jay
Hi Jon

Yes look into the error stacktrace and start to debug from that class as
suggested.

I have used a similar 3rd field for OTP and had my own credential
configured like yours...

And I had my own extended AuthenticationHandler as below where I handled my
credential *OTPUsernamePasswordCredential  *

Hope this would give some idea

public class MyRadiusAuthenticationHandler extends
AbstractUsernamePasswordAuthenticationHandler {

/** Array of RADIUS servers to authenticate against. */
@NotNull
@Size(min = 1)
private List servers;

/**
 * Determines whether to fail over to the next configured RadiusServer if
there was an exception.
 */
private boolean failoverOnException;

/**
 * Determines whether to fail over to the next configured RadiusServer if
there was an authentication failure.
 */
private boolean failoverOnAuthenticationFailure;

@Override
protected final HandlerResult authenticateUsernamePasswordInternal(final
UsernamePasswordCredential credential) throws GeneralSecurityException,
PreventedException {

*OTPUsernamePasswordCredential *otpCredential = null;

if (credential instanceof OTPUsernamePasswordCredential) {
otpCredential = (OTPUsernamePasswordCredential) credential;
}

final String username = otpCredential.getUsername();
for (final RadiusServer radiusServer : this.servers) {
logger.debug("Attempting to authenticate {} at {}", username, radiusServer);
try {
if (radiusServer.authenticate(username, otpCredential.getOtp())) {
return createHandlerResult(otpCredential, new SimplePrincipal(username),
null);
}

if (!this.failoverOnAuthenticationFailure) {
throw new FailedLoginException();
}
logger.debug("failoverOnAuthenticationFailure enabled -- trying next
server");
} catch (final PreventedException e) {
if (!this.failoverOnException) {
throw e;
}
logger.warn("failoverOnException enabled -- trying next server.", e);
}
}
throw new FailedLoginException();
}

/**
 * Determines whether to fail over to the next configured RadiusServer if
there was an authentication failure.
 *
 * @param failoverOnAuthenticationFailure
 *boolean on whether to failover or not.
 */
public final void setFailoverOnAuthenticationFailure(final boolean
failoverOnAuthenticationFailure) {
this.failoverOnAuthenticationFailure = failoverOnAuthenticationFailure;
}

/**
 * Determines whether to fail over to the next configured RadiusServer if
there was an exception.
 *
 * @param failoverOnException
 *boolean on whether to failover or not.
 */
public final void setFailoverOnException(final boolean failoverOnException)
{
this.failoverOnException = failoverOnException;
}

public final void setServers(final List servers) {
this.servers = servers;
}
}


Cheers
Jay

On Wed, May 27, 2015 at 2:24 PM, Dmitriy Kopylenko 
wrote:

> Seems like the authentication manager is failing to recognize your
> UsernamePasswordCredentials subclass by running this piece of code:
>
>
> https://github.com/Jasig/cas/blob/v3.5.3/cas-server-core/src/main/java/org/jasig/cas/authentication/handler/support/AbstractUsernamePasswordAuthenticationHandler.java#L138
>
> The goal here is to figure out why. I’d personally step through a
> debugger, as there are no useful log instrumentation in authentication
> manager impl., etc.
>
> D.
>
> On May 27, 2015, at 9:16 AM, Jonathan Bell  wrote:
>
>  too quick on the enter.
> org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler
>
> On 2015-05-27 6:11 AM, Dmitriy Kopylenko wrote:
>
> What version of CAS and which authentication handler do you use?
>
> Dmitriy.
>
>
>  On May 27, 2015, at 8:59 AM, Jonathan Bell  
>  wrote:
>
> I am trying to add a third login field.  I am getting a message at login  
> "Credentials you provided are not supported by cas" Something obviously I am 
> missing in the modification.
>
> This is what I have done
>
> I created a new credentials class, with new getter/setter methods that 
> extends usernamepasswordcredentials.
>
> Modified login-webflow.xml and changed the var name credentials to my 
> credentials class.
> added binding property for new field.
>
> modified loginview.jsp to display new field.
> --
> You are currently subscribed to cas-user@lists.jasig.org as: 
> dkopyle...@unicon.net
> To unsubscribe, change settings or access archives, see 
> http://www.ja-sig.org/wiki/display/JSG/cas-user
>
>
> --
> You are currently subscribed to cas-user@lists.jasig.org as: 
> dkopyle...@unicon.net
> To unsubscribe, change settings or access archives, see 
> http://www.ja-sig.org/wiki/display/JSG/cas-user
>
>
> --
> You are currently subscribed to cas-user@lists.jasig.org as: 
> india@gmail.com
> To unsubscribe, change settings or access archives, see 
> http://www.ja-sig.org/wiki/display/JSG/cas-user
>
>

-- 
You are currently subscribed to cas-user@lists.jasig.org as: 
arch...@mail-archive.com
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Re:[cas-user] Adding additional login field

2015-05-27 Thread Jonathan Bell
Thanks for all the replies. 

As ususal it appears to be something more nebulous.  I got it working when I 
modified the usernamepasswordcredentials directly in ca-server-core to accept a 
third field. When I copied the classes into a separate package, they give the 
exception. 
It appears, that either i'm missing a property somewhere that needs to be 
updated to point to my package, or i failed to update another class to point to 
my package. 

Anyways, for now it works fine, although not ideal.
-- 
You are currently subscribed to cas-user@lists.jasig.org as: 
arch...@mail-archive.com
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user