View Javadoc

1   /*
2    * Copyright (c) 2004 UNINETT FAS
3    *
4    * This program is free software; you can redistribute it and/or modify it
5    * under the terms of the GNU General Public License as published by the Free
6    * Software Foundation; either version 2 of the License, or (at your option)
7    * any later version.
8    *
9    * This program is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11   * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12   * more details.
13   *
14   * You should have received a copy of the GNU General Public License along with
15   * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16   * Place - Suite 330, Boston, MA 02111-1307, USA.
17   */
18  
19  package no.feide.moria.webservices.v2_3;
20  
21  import java.rmi.Remote;
22  import no.feide.moria.servlet.soap.AuthenticationFailedException;
23  import no.feide.moria.servlet.soap.AuthenticationUnavailableException;
24  import no.feide.moria.servlet.soap.AuthorizationFailedException;
25  import no.feide.moria.servlet.soap.IllegalInputException;
26  import no.feide.moria.servlet.soap.InternalException;
27  import no.feide.moria.servlet.soap.UnknownTicketException;
28  
29  /***
30   * Defines v2.3 of the Moria2 SOAP interface.
31   */
32  public interface Authentication
33  extends Remote {
34  
35      /***
36       * Initiates authentication. This is the initial call done by a service to
37       * start a login attempt.
38       * @param attributes
39       *            The attributes the service wants returned on login.
40       * @param returnURLPrefix
41       *            The prefix of the URL the user is to be returned to after
42       *            successful authentication.
43       * @param returnURLPostfix
44       *            The optional postfix of the return URL.
45       * @param forceInteractiveAuthentication
46       *            If <code>true</code>, user is forced through authentication
47       *            even if SSO is possible.
48       * @return An URL to which the client is to be redirected to for
49       *         authentication.
50       * @throws AuthorizationFailedException
51       *             If the service is now allowed to perform this operation, or
52       *             if the service is not allowed to read one or more of the
53       *             requested attributes.
54       * @throws IllegalInputException
55       *             If the method is called with illegal parameters, such as a
56       *             <code>returnURLPrefix</code>/
57       *             <code>returnURLPostfix</code> combination that does not
58       *             yield a valid URL.
59       * @throws InternalException
60       *             If an internal problem prevents Moria2 from performing this
61       *             operation.
62       */
63      String initiateAuthentication(String[] attributes, String returnURLPrefix, String returnURLPostfix, boolean forceInteractiveAuthentication)
64      throws AuthorizationFailedException, IllegalInputException,
65      InternalException;
66  
67  
68      /***
69       * Performs direct non-interactive authentication. A redirect- and HTML-less
70       * login method. Only to be used in special cases where the client for some
71       * reason does not support the standard login procedure. Inherently insecure
72       * as the service will have knowledge of the plaintext password.
73       * @param attributes
74       *            The attributes the service wants returned following
75       *            authentication.
76       * @param username
77       *            The user name of the user to be authenticated.
78       * @param password
79       *            The password of the user to be authenticated.
80       * @return Array of attributes as requested.
81       * @throws AuthorizationFailedException
82       *             If the service is now allowed to perform this operation, or
83       *             if the service is not allowed to read one or more of the
84       *             requested attributes.
85       * @throws AuthenticationFailedException
86       *             If the user credentials (given by <code>username</code>/
87       *             <code>password</code>) are not valid.
88       * @throws AuthenticationUnavailableException
89       *             If the third-party authentication server responsible for
90       *             authenticating this user is not available.
91       * @throws IllegalInputException
92       *             If the method is called with illegal parameters.
93       * @throws InternalException
94       *             If an internal problem prevents Moria2 from performing this
95       *             operation.
96       */
97      Attribute[] directNonInteractiveAuthentication(String[] attributes, String username, String password)
98      throws AuthorizationFailedException, AuthenticationFailedException,
99      AuthenticationUnavailableException, IllegalInputException,
100     InternalException;
101 
102 
103     /***
104      * Performs proxy authentication. Called by a subsystem to authenticate a
105      * user.
106      * @param attributes
107      *            The attributes the service wants returned following proxy
108      *            authentication.
109      * @param proxyTicket
110      *            The proxy ticket given to the calling system by its initiator.
111      * @return Array of attributes as requested.
112      * @throws AuthorizationFailedException
113      *             If the service is now allowed to perform this operation, or
114      *             if the service is not allowed to read one or more of the
115      *             requested attributes.
116      * @throws IllegalInputException
117      *             If the method is called with illegal parameters.
118      * @throws InternalException
119      *             If an internal problem prevents Moria2 from performing this
120      *             operation.
121      * @throws UnknownTicketException
122      *             If the proxy ticket given by <code>proxyTicket</code> does
123      *             not match an existing and valid session.
124      */
125     Attribute[] proxyAuthentication(String[] attributes, String proxyTicket)
126     throws AuthorizationFailedException, IllegalInputException,
127     InternalException, UnknownTicketException;
128 
129 
130     /***
131      * Gets a proxy ticket. A service may as part of the initial attribute
132      * request ask for a ticket granting ticket that later may be used in this
133      * call. The returned proxy ticket is to be handed over to the specified
134      * underlying system and may be used by that system only to authenticate the
135      * request.
136      * @param ticketGrantingTicket
137      *            A TGT that has been issued previously.
138      * @param proxyServicePrincipal
139      *            The service which the proxy ticket should be issued for.
140      * @return A proxy ticket.
141      * @throws AuthorizationFailedException
142      *             If the service is now allowed to perform this operation.
143      * @throws IllegalInputException
144      *             If the method is called with illegal parameters.
145      * @throws InternalException
146      *             If an internal problem prevents Moria2 from performing this
147      *             operation.
148      * @throws UnknownTicketException
149      *             If the ticket granting ticket given by
150      *             <code>ticketGrantingTicket</code> does not match an
151      *             existing and valid session.
152      */
153     String getProxyTicket(String ticketGrantingTicket, String proxyServicePrincipal)
154     throws AuthorizationFailedException, IllegalInputException,
155     InternalException, UnknownTicketException;
156 
157 
158     /***
159      * Gets user attributes. Called by the service when the user returns after a
160      * successful login.
161      * @param serviceTicket
162      *            The ticket included in the return request issued by the
163      *            client.
164      * @return Array of attributes as requested in initiateAuthentication.
165      * @throws AuthorizationFailedException
166      *             If the service is now allowed to perform this operation.
167      * @throws IllegalInputException
168      *             If the method is called with an illegal parameter.
169      * @throws InternalException
170      *             If an internal problem prevents Moria2 from performing this
171      *             operation.
172      * @throws UnknownTicketException
173      *             If the service ticket given by <code>serviceTicket</code>
174      *             does not match an existing or valid session.
175      */
176     Attribute[] getUserAttributes(String serviceTicket)
177     throws AuthorizationFailedException, IllegalInputException,
178     InternalException, UnknownTicketException;
179 
180 
181     /***
182      * Verifies the existence of a given user in the underlying directories.
183      * @param username
184      *            The username to be validated.
185      * @return <code>true</code> if the user is found, otherwise
186      *         <code>false</code>.
187      * @throws AuthorizationFailedException
188      *             If the service is now allowed to perform this operation.
189      * @throws AuthenticationUnavailableException
190      *             If the authentication server where this user belongs is not
191      *             available.
192      * @throws IllegalInputException
193      *             If the method is called with an illegal parameter.
194      * @throws InternalException
195      *             If an internal problem prevents Moria2 from performing this
196      *             operation.
197      */
198     boolean verifyUserExistence(String username)
199     throws AuthorizationFailedException, AuthenticationUnavailableException,
200     IllegalInputException, InternalException;
201 }