First set of logout base classes and non-building draft of SP-initiated logout.
[shibboleth/sp.git] / shibsp / SessionCache.h
index e5b0bed..9e2d453 100644 (file)
@@ -44,6 +44,13 @@ namespace shibsp {
         virtual ~Session() {}
     public:
         /**
+         * Returns the session key.
+         *
+         * @return unique ID of session
+         */
+        virtual const char* getID() const=0;
+
+        /**
          * Returns the address of the client associated with the session.
          * 
          * @return  the client's network address
@@ -56,7 +63,14 @@ namespace shibsp {
          * @return the IdP's entityID
          */
         virtual const char* getEntityID() const=0;
-        
+
+        /**
+         * Returns the protocol family used to initiate the session.
+         *
+         * @return the protocol constant that represents the general SSO protocol used
+         */
+        virtual const char* getProtocol() const=0;
+
         /**
          * Returns the UTC timestamp on the authentication event at the IdP.
          * 
@@ -176,13 +190,13 @@ namespace shibsp {
         /**
          * Inserts a new session into the cache.
          * 
-         * <p>The SSO token remains owned by the caller and is copied by the
-         * cache. Any Attributes supplied become the property of the cache.  
+         * <p>The SSO tokens and Attributes remain owned by the caller and are copied by the cache.
          * 
          * @param expires           expiration time of session
          * @param application       reference to Application that owns the Session
          * @param client_addr       network address of client
          * @param issuer            issuing metadata of assertion issuer, if known
+         * @param protocol          protocol family used to initiate the session
          * @param nameid            principal identifier, normalized to SAML 2, if any
          * @param authn_instant     UTC timestamp of authentication at IdP, if known
          * @param session_index     index of session between principal and IdP, if any
@@ -197,14 +211,32 @@ namespace shibsp {
             const Application& application,
             const char* client_addr=NULL,
             const opensaml::saml2md::EntityDescriptor* issuer=NULL,
+            const XMLCh* protocol=NULL,
             const opensaml::saml2::NameID* nameid=NULL,
-            const char* authn_instant=NULL,
-            const char* session_index=NULL,
-            const char* authncontext_class=NULL,
-            const char* authncontext_decl=NULL,
+            const XMLCh* authn_instant=NULL,
+            const XMLCh* session_index=NULL,
+            const XMLCh* authncontext_class=NULL,
+            const XMLCh* authncontext_decl=NULL,
             const std::vector<const opensaml::Assertion*>* tokens=NULL,
             const std::multimap<std::string,Attribute*>* attributes=NULL
             )=0;
+
+        /**
+         * Deletes an existing session or sessions.
+         * 
+         * @param issuer        source of session(s)
+         * @param nameid        name identifier associated with the session(s) to terminate
+         * @param index         index of session, or NULL for all sessions associated with other parameters
+         * @param application   reference to Application that owns the session(s)
+         * @param sessions      on exit, contains the IDs of the matching sessions removed
+         */
+        virtual void remove(
+            const opensaml::saml2md::EntityDescriptor* issuer,
+            const opensaml::saml2::NameID& nameid,
+            const char* index,
+            const Application& application,
+            std::vector<std::string>& sessions
+            )=0;
 #endif
 
         /**
@@ -228,9 +260,8 @@ namespace shibsp {
          * 
          * @param key           session key
          * @param application   reference to Application that owns the Session
-         * @param client_addr   network address of client (if known)
          */
-        virtual void remove(const char* key, const Application& application, const char* client_addr)=0;
+        virtual void remove(const char* key, const Application& application)=0;
     };
 
 #ifndef SHIBSP_LITE