From: lajoie Date: Sun, 12 Nov 2006 21:55:20 +0000 (+0000) Subject: Initial session classes X-Git-Tag: v2.1.3~692 X-Git-Url: https://repo.niif.hu/gitweb/gitweb.cgi?p=java-idp.git;a=commitdiff_plain;h=3d8f097e0e713a3000154826afed6b580573fcb1;ds=sidebyside Initial session classes git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@2070 ab3bd59b-922f-494d-bb5f-6f0a3c29deca --- diff --git a/src/edu/internet2/middleware/shibboleth/idp/authn/AuthenticationManager.java b/src/edu/internet2/middleware/shibboleth/idp/authn/AuthenticationManager.java index 404f99c..3852951 100644 --- a/src/edu/internet2/middleware/shibboleth/idp/authn/AuthenticationManager.java +++ b/src/edu/internet2/middleware/shibboleth/idp/authn/AuthenticationManager.java @@ -1,10 +1,48 @@ +/* + * Copyright [2006] [University Corporation for Advanced Internet Development, Inc.] + * + * Licensed 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 edu.internet2.middleware.shibboleth.idp.authn; import javax.servlet.http.HttpServlet; +import edu.internet2.middleware.shibboleth.idp.session.SessionManager; + /** * Manager responsible for handling an authentication requests. */ public class AuthenticationManager extends HttpServlet { + /** Session manager to be used by this servlet */ + private SessionManager sessionMgr; + + /** + * Gets the session manager to be used by this servlet. + * + * @return session manager to be used by this servlet + */ + public SessionManager getSessionManager(){ + return sessionMgr; + } + + /** + * Sets the session manager to be used by this servlet. + * + * @param manager session manager to be used by this servlet + */ + public void setSessionManager(SessionManager manager){ + sessionMgr = manager; + } } \ No newline at end of file diff --git a/src/edu/internet2/middleware/shibboleth/idp/session/AuthenticationMethodInformation.java b/src/edu/internet2/middleware/shibboleth/idp/session/AuthenticationMethodInformation.java new file mode 100644 index 0000000..dfc2c69 --- /dev/null +++ b/src/edu/internet2/middleware/shibboleth/idp/session/AuthenticationMethodInformation.java @@ -0,0 +1,46 @@ +/* + * Copyright [2006] [University Corporation for Advanced Internet Development, Inc.] + * + * Licensed 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 edu.internet2.middleware.shibboleth.idp.session; + +import org.joda.time.DateTime; + +/** + * Information about an authentication method employed by a user. + */ +public interface AuthenticationMethodInformation { + + /** + * Gets the unique identifier for the authentication method. + * + * @return unique identifier for the authentication method + */ + public String getAuthenticationMethod(); + + /** + * Gets the time the user authenticated with this member. + * + * @return time the user authenticated with this member + */ + public DateTime getAuthenticationInstance(); + + /** + * Gets the duration of this authentication method. + * + * @return duration of this authentication method + */ + public long getAuthenticationDuration(); +} \ No newline at end of file diff --git a/src/edu/internet2/middleware/shibboleth/idp/session/ServiceInformation.java b/src/edu/internet2/middleware/shibboleth/idp/session/ServiceInformation.java new file mode 100644 index 0000000..472879b --- /dev/null +++ b/src/edu/internet2/middleware/shibboleth/idp/session/ServiceInformation.java @@ -0,0 +1,54 @@ +/* + * Copyright [2006] [University Corporation for Advanced Internet Development, Inc.] + * + * Licensed 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 edu.internet2.middleware.shibboleth.idp.session; + +import org.joda.time.DateTime; +import org.opensaml.saml2.core.NameID; + +/** + * Information about a service a user has logged in to. + */ +public interface ServiceInformation { + + /** + * Gets the unique identifier for the service. + * + * @return unique identifier for the service + */ + public String getEntityID(); + + /** + * Gets the time the user authenticated to the service. + * + * @return time the user authenticated to the service + */ + public DateTime getAuthenticationInstance(); + + /** + * Gets the authentication method used to log into the service. + * + * @return authentication method used to log into the service + */ + public AuthenticationMethodInformation getAuthenticationMethod(); + + /** + * Gets the NameID used for the subject/user with this service. + * + * @return NameID used for the subject/user with this service + */ + public NameID getSubjectNameID(); +} \ No newline at end of file diff --git a/src/edu/internet2/middleware/shibboleth/idp/session/Session.java b/src/edu/internet2/middleware/shibboleth/idp/session/Session.java new file mode 100644 index 0000000..2a62ec2 --- /dev/null +++ b/src/edu/internet2/middleware/shibboleth/idp/session/Session.java @@ -0,0 +1,62 @@ +/* + * Copyright [2006] [University Corporation for Advanced Internet Development, Inc.] + * + * Licensed 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 edu.internet2.middleware.shibboleth.idp.session; + +import java.util.List; + +import org.joda.time.DateTime; + +/** + * Session information for user logged into the IdP. + */ +public interface Session { + + /** + * Gets the unique identifier of the session. + * + * @return unique identifier of the session + */ + public String getSessionID(); + + /** + * Gets the principal ID of the user. + * + * @return principal ID of the user + */ + public String getPrincipalID(); + + /** + * Gets the time of the last activity from the user. + * + * @return time of the last activity from the user + */ + public DateTime getLastActivityInstance(); + + /** + * Gets the methods by which the user has authenticated to the IdP. + * + * @return methods by which the user has authenticated to the IdP + */ + public List getAuthenticationMethods(); + + /** + * Gets the services the user has logged in to. + * + * @return services the user has logged in to + */ + public List getServicesInformation(); +} \ No newline at end of file diff --git a/src/edu/internet2/middleware/shibboleth/idp/session/SessionManager.java b/src/edu/internet2/middleware/shibboleth/idp/session/SessionManager.java new file mode 100644 index 0000000..f821942 --- /dev/null +++ b/src/edu/internet2/middleware/shibboleth/idp/session/SessionManager.java @@ -0,0 +1,46 @@ +/* + * Copyright [2006] [University Corporation for Advanced Internet Development, Inc.] + * + * Licensed 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 edu.internet2.middleware.shibboleth.idp.session; + +/** + * Session managers are responsible for creating, managing, and destroying Shibboleth IdP sessions. + */ +public interface SessionManager { + + /** + * Creates a Shibboleth session. + * + * @return a Shibboleth session + */ + public Session createSession(); + + /** + * Gets the user's session based on session's ID. + * + * @param sessionID the ID of the session + * + * @return the session + */ + public Session getSession(String sessionID); + + /** + * Destroys the session. + * + * @param sessionID the ID of the session. + */ + public void destroySession(String sessionID); +} \ No newline at end of file