= AuthenticationStrategyUsingSession
:Notice: 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.

Checks that an already-present xref:refguide:applib:index/services/iactnlayer/InteractionContext.adoc[InteractionContext] (obtained from the _HttpSession_ ) is still _org.apache.causeway.core.security.authentication.manager.AuthenticationManager#isSessionValid(InteractionContext) valid_ , and re-binds the xref:refguide:applib:index/services/iactnlayer/InteractionContext.adoc[InteractionContext] onto the _HttpSession_ .

Note that this implementation is not particularly "restful"; normally REST APIs are expected to be stateless whereas this implementation requires a session to obtain the xref:refguide:applib:index/services/iactnlayer/InteractionContext.adoc[InteractionContext] . Typically it would be combined with Shiro, whose default behaviour (not suppressed by this filter) is indeed to store the xref:refguide:applib:index/services/iactnlayer/InteractionContext.adoc[InteractionContext] on the session.

The session is looked-up from the _HttpSession_ using the value _AuthenticationStrategyUsingSession#HTTP_SESSION_AUTHENTICATION_SESSION_KEY_

== API

[source,java]
.AuthenticationStrategyUsingSession.java
----
class AuthenticationStrategyUsingSession {
  public static final String HTTP_SESSION_AUTHENTICATION_SESSION_KEY;
  InteractionContext lookupValid(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
  void bind(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, InteractionContext authentication)
}
----

