WICKET-6242 Improved synchronization for signIn. Added missing header license.
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/263e8c14 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/263e8c14 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/263e8c14 Branch: refs/heads/wicket-7.x Commit: 263e8c14476f9970d2ccfd8476f371149f2e2cb4 Parents: 56f947e Author: Andrea Del Bene <adelb...@apache.org> Authored: Tue Sep 13 12:37:59 2016 +0200 Committer: Andrea Del Bene <adelb...@apache.org> Committed: Tue Sep 13 14:53:50 2016 +0200 ---------------------------------------------------------------------- .../authentication/AuthenticatedWebSession.java | 14 ++++---------- .../authentication/AuthenticatedWebSessionTest.java | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/263e8c14/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSession.java ---------------------------------------------------------------------- diff --git a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSession.java b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSession.java index f0b450c..f11d718 100644 --- a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSession.java +++ b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSession.java @@ -63,17 +63,11 @@ public abstract class AuthenticatedWebSession extends AbstractAuthenticatedWebSe */ public final boolean signIn(final String username, final String password) { - if (signedIn.compareAndSet(false, true)) + boolean authenticated = authenticate(username, password); + + if (authenticated && signedIn.compareAndSet(false, true)) { - boolean authenticated = authenticate(username, password); - if (authenticated) - { - bind(); - } - else - { - signedIn.set(false); - } + bind(); } return signedIn.get(); } http://git-wip-us.apache.org/repos/asf/wicket/blob/263e8c14/wicket-auth-roles/src/test/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSessionTest.java ---------------------------------------------------------------------- diff --git a/wicket-auth-roles/src/test/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSessionTest.java b/wicket-auth-roles/src/test/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSessionTest.java index c444d81..d91dd9d 100644 --- a/wicket-auth-roles/src/test/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSessionTest.java +++ b/wicket-auth-roles/src/test/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSessionTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.wicket.authroles.authentication; import static java.util.Locale.getDefault;