Re: [cas-user] Re: AUP and X509 authentication

2018-09-25 Thread Curtis Ruck
While that looks like it would address the issue, i believe I will wait as 
my copy+paste'd solution works now.  I really dislike the arbitrary nature 
of CAS now, while the xml wasn't easy/fun, i definitely think we've gone 
backwards now.

On Monday, September 24, 2018 at 11:51:48 PM UTC-4, Colin Wilkinson wrote:
>
> Hi,
>
> I had to do something similar for the Password Management and did not want 
> to recreate everything. So the solution I came up with was to remove the 
> passwordManagementWebflowConfigurer from the execution plan and set the 
> order to one before my configurer and readd the 
> passwordManagementWebflowConfigurer.
>
> It's serious issue and pain that you can set a definite order to the item 
> like these CasWebflowConfigurer that actually rely on the order to execute. 
> This needs to be able to be configured.
>
> I hope this helps.
>
> @Autowired
> @Qualifier("passwordManagementWebflowConfigurer")
> private CasWebflowConfigurer passwordManagementWebflowConfigurer;
>
> @Override
> public void configureWebflowExecutionPlan(final 
> CasWebflowExecutionPlan plan) {
> plan.getWebflowConfigurers().removeIf(casWebflowConfigurer -> 
> casWebflowConfigurer.getName().equals(passwordManagementWebflowConfigurer.getName()));
> final int order = Ordered.LOWEST_PRECEDENCE - 100;
>
> try {
> if 
> (AopUtils.isJdkDynamicProxy(passwordManagementWebflowConfigurer)) {
> ((PasswordManagementWebflowConfigurer) ((Advised) 
> passwordManagementWebflowConfigurer).getTargetSource().getTarget()).setOrder(order);
> } else {
> ((PasswordManagementWebflowConfigurer) 
> passwordManagementWebflowConfigurer).setOrder(order);
> }
> } catch (final Exception exception) {
> LOGGER.error("The following error ocurred during reconfigure 
> of startup sequence.", exception);
> }
>
> 
> plan.registerWebflowConfigurer(passwordManagementWebflowConfigurer);
> 
> plan.registerWebflowConfigurer(vicUniPasswordManagementWebflowReconfigurer());
> }
>
>
>
> On Tuesday, 25 September 2018 12:49:25 UTC+10, Andy Ng wrote:
>>
>> Hi Curtis,
>>
>> Ah I missed to mention something, 
>>
>> when you tries to override a Bean inside a Configuration file, whether or 
>> not is actually override success depends on the load sequence. Which one 
>> load last will be the actual bean to be used.
>> See: 
>> https://stackoverflow.com/questions/11833804/overriding-bean-configuration-in-spring
>>
>> To make sure your defined bean takes effect, you might need to use the 
>> @Import notation.
>>
>> So you could try out the following:
>>
>> ===
>> @Configuration("myDomainX509AuthenticationWebflowConfiguration ")
>> @EnableConfigurationProperties(CasConfigurationProperties.class)
>> @Slf4j
>> @Import(X509AuthenticationWebflowConfiguration.class)
>> public class MyDomainX509AuthenticationWebflowConfiguration implements 
>> CasWebflowExecutionPlanConfigurer {
>>
>> ..
>>
>>
>>
>>
>> ===
>>
>> If this still doens't work, then maybe you might needs to stick to your 
>> solution then...
>>
>> Cheers!
>> - Andy
>>
>>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/5c83782a-506f-41d7-9c64-4fecac01b347%40apereo.org.


Re: [cas-user] Re: AUP and X509 authentication

2018-09-24 Thread Colin Wilkinson
Hi,

I had to do something similar for the Password Management and did not want 
to recreate everything. So the solution I came up with was to remove the 
passwordManagementWebflowConfigurer from the execution plan and set the 
order to one before my configurer and readd the 
passwordManagementWebflowConfigurer.

It's serious issue and pain that you can set a definite order to the item 
like these CasWebflowConfigurer that actually rely on the order to execute. 
This needs to be able to be configured.

I hope this helps.

@Autowired
@Qualifier("passwordManagementWebflowConfigurer")
private CasWebflowConfigurer passwordManagementWebflowConfigurer;

@Override
public void configureWebflowExecutionPlan(final CasWebflowExecutionPlan 
plan) {
plan.getWebflowConfigurers().removeIf(casWebflowConfigurer -> 
casWebflowConfigurer.getName().equals(passwordManagementWebflowConfigurer.getName()));
final int order = Ordered.LOWEST_PRECEDENCE - 100;

try {
if 
(AopUtils.isJdkDynamicProxy(passwordManagementWebflowConfigurer)) {
((PasswordManagementWebflowConfigurer) ((Advised) 
passwordManagementWebflowConfigurer).getTargetSource().getTarget()).setOrder(order);
} else {
((PasswordManagementWebflowConfigurer) 
passwordManagementWebflowConfigurer).setOrder(order);
}
} catch (final Exception exception) {
LOGGER.error("The following error ocurred during reconfigure of 
startup sequence.", exception);
}

plan.registerWebflowConfigurer(passwordManagementWebflowConfigurer);

plan.registerWebflowConfigurer(vicUniPasswordManagementWebflowReconfigurer());
}



On Tuesday, 25 September 2018 12:49:25 UTC+10, Andy Ng wrote:
>
> Hi Curtis,
>
> Ah I missed to mention something, 
>
> when you tries to override a Bean inside a Configuration file, whether or 
> not is actually override success depends on the load sequence. Which one 
> load last will be the actual bean to be used.
> See: 
> https://stackoverflow.com/questions/11833804/overriding-bean-configuration-in-spring
>
> To make sure your defined bean takes effect, you might need to use the 
> @Import notation.
>
> So you could try out the following:
>
> ===
> @Configuration("myDomainX509AuthenticationWebflowConfiguration ")
> @EnableConfigurationProperties(CasConfigurationProperties.class)
> @Slf4j
> @Import(X509AuthenticationWebflowConfiguration.class)
> public class MyDomainX509AuthenticationWebflowConfiguration implements 
> CasWebflowExecutionPlanConfigurer {
>
> ..
>
>
>
>
> ===
>
> If this still doens't work, then maybe you might needs to stick to your 
> solution then...
>
> Cheers!
> - Andy
>
>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/5ce66094-a752-4add-a7f6-e650b52d5466%40apereo.org.


Re: [cas-user] Re: AUP and X509 authentication

2018-09-24 Thread Andy Ng
Hi Curtis,

Ah I missed to mention something, 

when you tries to override a Bean inside a Configuration file, whether or 
not is actually override success depends on the load sequence. Which one 
load last will be the actual bean to be used.
See: 
https://stackoverflow.com/questions/11833804/overriding-bean-configuration-in-spring

To make sure your defined bean takes effect, you might need to use the 
@Import notation.

So you could try out the following:
===
@Configuration("myDomainX509AuthenticationWebflowConfiguration ")
@EnableConfigurationProperties(CasConfigurationProperties.class)
@Slf4j
@Import(X509AuthenticationWebflowConfiguration.class)
public class MyDomainX509AuthenticationWebflowConfiguration implements 
CasWebflowExecutionPlanConfigurer {

..



===

If this still doens't work, then maybe you might needs to stick to your 
solution then...

Cheers!
- Andy

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/928e1c39-83a2-44f1-b146-df43846da1a0%40apereo.org.


Re: [cas-user] Re: AUP and X509 authentication

2018-09-24 Thread Curtis Ruck
That is what i tried initially, but the transition from success to create
tgt was still happening.  It wasn't until i removed it the , that i could
stop that transition, and instead send it to aup.

I believe the reason I couldn't just provide my own x509WebflowConfigurer
bean in loo of the default one, is the way that specific Configuration
class works.  It implements CasWebflowExecutionPlanConfigurer, and that
method calls  x509WebflowConfigurer() which means it doesn't get Autowired
in, it gets called directly.

--
Curtis Ruck


On Mon, Sep 24, 2018 at 12:45 PM Andy Ng  wrote:

> Hi Curtis,
>
> *> So I finally solved this*
> Great that you solve it
>
> *>  essentially had to remove the cas-server-support-x509-webflow
> dependency... where getting rid of the spring xml configura*tion makes
> this more difficult
> There is no need to remove the entire dependency to make small changes, *the
> ability to do small tweaks is still here,* just using a different form
> then spring.xml.
>
> I do not have your source code so I cannot pin point exactly what you did,
> but I think you have editing something in this file -
> "
> https://github.com/apereo/cas/blob/v5.3.3/support/cas-server-support-x509-webflow/src/main/java/org/apereo/cas/web/flow/X509WebflowConfigurer.java;,
> correct?
>
> If so, you can try the following (Did not tried it yet, might not work out
> of the box, I am not accountable for the code breaking on you if it breaks
> ):
> 1. keep the *cas-server-support-x509-webflow dependency *, do not need to
> discard it.
> 2. *spring.factories (src/main/resource/META-INF/spring-factories)*
> org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
> mydomain.com.example.MyDomainX509AuthenticationWebflowConfiguration
>
> 3. *MyDomainX509AuthenticationWebflowConfiguration.java*
> (src/main/java/yourdomain/
> MyDomainX509AuthenticationWebflowConfiguration.java)
> @Configuration("myDomainX509AuthenticationWebflowConfiguration ")
> @EnableConfigurationProperties(CasConfigurationProperties.class)
> @Slf4j
> public class MyDomainX509AuthenticationWebflowConfiguration implements
> CasWebflowExecutionPlanConfigurer {
>
>
> @Autowired(required = false)
> @Qualifier("loginFlowRegistry")
> private FlowDefinitionRegistry loginFlowDefinitionRegistry;
> @Autowired(required = false)
> private FlowBuilderServices flowBuilderServices;
> @Autowired
> private ApplicationContext applicationContext;
> @Autowired
> private CasConfigurationProperties casProperties;
>
>
> @Bean
> @DependsOn("defaultWebflowConfigurer") @DependsOn("YOUR_OWN_DEPENDENCY")
> public CasWebflowConfigurer x509WebflowConfigurer() {
> return new MyDomainX509WebflowConfigurer(flowBuilderServices,
> loginFlowDefinitionRegistry, applicationContext, casProperties);
> }
>
> }
>
> 4. *MyDomainX509WebflowConfigurer.java*
> (src/main/java/yourdomain/MyDomainX509WebflowConfigurer.java)
> Edit what you need inside "
> https://github.com/apereo/cas/blob/v5.3.3/support/cas-server-support-x509-webflow/src/main/java/org/apereo/cas/web/flow/X509WebflowConfigurer.java;,
> you could even use super.doInitialize() to reduce the code needed to be
> copied.
>
>
> Then you should be able to edit only the necessary part inside your CAS
> without replacing the entire project. Is this similar to what you have in
> mind?
>
> Cheers!
> - Andy
>
> --
> - Website: https://apereo.github.io/cas
> - Gitter Chatroom: https://gitter.im/apereo/cas
> - List Guidelines: https://goo.gl/1VRrw7
> - Contributions: https://goo.gl/mh7qDG
> ---
> You received this message because you are subscribed to the Google Groups
> "CAS Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cas-user+unsubscr...@apereo.org.
> To view this discussion on the web visit
> https://groups.google.com/a/apereo.org/d/msgid/cas-user/5bb54980-4ae9-4ea2-a5b4-b5031aeaa11d%40apereo.org
> 
> .
>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/CAFgGLFee4EfLBPQqk0-Ku0en%3DyhoYgaZaAJz%2BMjhKkwmoRpY7w%40mail.gmail.com.