Coverage Report - org.apache.shiro.mgt.SubjectDAO
 
Classes in this File Line Coverage Branch Coverage Complexity
SubjectDAO
N/A
N/A
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.shiro.mgt;
 20  
 
 21  
 import org.apache.shiro.subject.Subject;
 22  
 
 23  
 /**
 24  
  * A {@code SubjectDAO} is responsible for persisting a Subject instance's internal state such that the Subject instance
 25  
  * can be recreated at a later time if necessary.
 26  
  * <p/>
 27  
  * Shiro's default {@code SecurityManager} implementations typically use a {@code SubjectDAO} in conjunction
 28  
  * with a {@link SubjectFactory}: after the {@code SubjectFactory} creates a {@code Subject} instance, the
 29  
  * {@code SubjectDAO} is used to persist that subject's state such that it can be accessed later if necessary.
 30  
  * <h3>Usage</h3>
 31  
  * It should be noted that this component is used by {@code SecurityManager} implementations to manage Subject
 32  
  * state persistence.  It does <em>not</em> make Subject instances accessible to the
 33  
  * application (e.g. via {@link org.apache.shiro.SecurityUtils#getSubject() SecurityUtils.getSubject()}).
 34  
  *
 35  
  * @see DefaultSubjectDAO
 36  
  * @since 1.2
 37  
  */
 38  
 public interface SubjectDAO {
 39  
 
 40  
     /**
 41  
      * Persists the specified Subject's state for later access.  If there is a no existing state persisted, this
 42  
      * persists it if possible (i.e. a create operation).  If there is existing state for the specified {@code Subject},
 43  
      * this method updates the existing state to reflect the current state (i.e. an update operation).
 44  
      *
 45  
      * @param subject the Subject instance for which its state will be created or updated.
 46  
      * @return the Subject instance to use after persistence is complete.  This can be the same as the method argument
 47  
      * if the underlying implementation does not need to make any Subject changes.
 48  
      */
 49  
     Subject save(Subject subject);
 50  
 
 51  
     /**
 52  
      * Removes any persisted state for the specified {@code Subject} instance.  This is a delete operation such that
 53  
      * the Subject's state will not be accessible at a later time.
 54  
      *
 55  
      * @param subject the Subject instance for which any persistent state should be deleted.
 56  
      */
 57  
     void delete(Subject subject);
 58  
 }