Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'unauthorizedRedirectUrl' usable for pac4j module #3293

Closed
wants to merge 9 commits into from
Closed

Add 'unauthorizedRedirectUrl' usable for pac4j module #3293

wants to merge 9 commits into from

Conversation

cifren
Copy link
Contributor

@cifren cifren commented May 3, 2018

Re-opening PR from #3138

/**
* Protected casProperties.
*/
protected CasConfigurationProperties casProperties;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all protected instance. Remove their javadocs. Only mark those as protected that are needed by your changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what I see, they all need to be protected because those variables will be accessed by configureWebflowContextForService and the constructor

Copy link
Member

@mmoayyed mmoayyed May 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't configureWebflowContextForService owned by the same class that houses all the properties? If so, you do not need a field to be marked as protected only to then access it from a method inside the same class that has the field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right

@@ -96,7 +124,12 @@ private void configureWebflowContextForService(final RequestContext context) {
WebUtils.putService(context, service);
}

private void configureWebflowContext(final RequestContext context) {
/**
* configureWebflowContext.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to explain this better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try do my best

*
* @param context a request context
*/
protected void configureCookieGenerators(final RequestContext context) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to explain this better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what it does... Do you have a suggestion ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensures cookie paths are properly set for the generators when the flow is initialized.


/**
* Get ServicesManager.
*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove.

final TicketGrantingTicket tgt = this.centralAuthenticationService.createTicketGrantingTicket(authenticationResult);
WebUtils.putTicketGrantingTicketInScopes(context, tgt);
} catch (final PrincipalException e) {
LOGGER.warn("PrincipalException caught on service [{}]", e.getMessage());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain the message better.

* @author Francis Le Coq
* @since 5.2
*/
public class Pac4jInitialFlowSetupAction extends InitialFlowSetupAction {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

Copy link
Contributor Author

@cifren cifren May 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because on Pac4j you dont need configureCookieGenerators(context); configureWebflowContext(context); to be executed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, you need to simply add a flag that displays that behavior, rather than adding a whole new class and action and accompanying beans.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Furthermore, as far as I can tell the configuration of cookie generators only sets paths for the generators. Therefore, is there a reason that operation is removed? does it cause a failure or break something? If not, you should simply let it be and remove this class altogether.

@@ -49,6 +50,8 @@ protected void doInitialize() {
createClientActionActionState(flow);
createStopWebflowViewState(flow);
createSaml2ClientLogoutAction();

createAuthnFailureAction(flow);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createAuthnFailureActionState

setStartState(flow, actionState);
}

private void createAuthnFailureAction(final Flow flow){
final ActionState actionState = createActionState(flow, "pac4jFailure",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a constant for the failure state id.

@cifren
Copy link
Contributor Author

cifren commented May 5, 2018

I updated for the requested changes

The master branch will need more work because changes have been made and some files have been deleted and created elsewhere or renamed. Git does not seem to know how to deal with those so I will need to adapt the code to the new master changes.

final TicketGrantingTicket tgt = this.centralAuthenticationService.createTicketGrantingTicket(authenticationResult);
WebUtils.putTicketGrantingTicketInScopes(context, tgt);
} catch (final PrincipalException e) {
LOGGER.warn("Principal attributes have not been validated on service [{}]", e.getMessage());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly should change to:

LOGGER.warn(e.getMessage(), e);

The error message that is indicated above does not make that much sense. Principal attributes cannot be validated in any way by CAS.

private final CookieRetrievingCookieGenerator warnCookieGenerator;
private final CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator;
private final List<ArgumentExtractor> argumentExtractors;
private CasConfigurationProperties casProperties;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason these variables are removed to not be final?

@stale
Copy link

stale bot commented May 21, 2018

This patch has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Pending label May 21, 2018
@stale
Copy link

stale bot commented May 28, 2018

This patch has been automatically closed because it has not had recent activity. If you wish to resume work, please re-open the pull request and continue as usual. Thank you for your contributions.

@stale stale bot closed this May 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants