return ordinal() > s.ordinal();\r
}\r
}\r
- \r
+\r
+ public static enum AuthenticationType {\r
+ CREDENTIALS, COOKIE, CERTIFICATE;\r
+ \r
+ public boolean isStandard() {\r
+ return ordinal() <= COOKIE.ordinal();\r
+ }\r
+ }\r
+\r
@Documented\r
@Retention(RetentionPolicy.RUNTIME)\r
public @interface Unused {\r
\r
import com.gitblit.Constants.AccessPermission;\r
import com.gitblit.Constants.AccessRestrictionType;\r
+import com.gitblit.Constants.AuthenticationType;\r
import com.gitblit.Constants.AuthorizationControl;\r
import com.gitblit.Constants.FederationRequest;\r
import com.gitblit.Constants.FederationStrategy;\r
import com.gitblit.utils.ObjectCache;\r
import com.gitblit.utils.StringUtils;\r
import com.gitblit.utils.TimeUtils;\r
+import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.WicketUtils;\r
\r
/**\r
UserModel model = HttpUtils.getUserModelFromCertificate(httpRequest, checkValidity, oids);\r
if (model != null) {\r
// grab real user model and preserve certificate serial number\r
+ GitBlitWebSession session = GitBlitWebSession.get();\r
+ session.authenticationType = AuthenticationType.CERTIFICATE;\r
UserModel user = getUserModel(model.username);\r
logger.info(MessageFormat.format("{0} authenticated by client certificate from {1}",\r
user.username, httpRequest.getRemoteAddr()));\r
if (allowCookieAuthentication() && cookies != null && cookies.length > 0) {\r
// Grab cookie from Browser Session\r
UserModel user = authenticate(cookies);\r
- return user;\r
+ if (user != null) {\r
+ GitBlitWebSession session = GitBlitWebSession.get();\r
+ session.authenticationType = AuthenticationType.COOKIE;\r
+ return user;\r
+ }\r
}\r
return null;\r
}\r
import org.apache.wicket.protocol.http.WebSession;\r
import org.apache.wicket.protocol.http.request.WebClientInfo;\r
\r
+import com.gitblit.Constants.AuthenticationType;\r
import com.gitblit.models.UserModel;\r
\r
public final class GitBlitWebSession extends WebSession {\r
\r
private AtomicBoolean isForking;\r
\r
+ public AuthenticationType authenticationType;\r
+ \r
public GitBlitWebSession(Request request) {\r
super(request);\r
isForking = new AtomicBoolean();\r
+ authenticationType = AuthenticationType.CREDENTIALS;\r
}\r
\r
public void invalidate() {\r