View Javadoc

1   /* Copyright 2004 Acegi Technology Pty Limited
2    *
3    * Licensed under the Apache License, Version 2.0 (the "License");
4    * you may not use this file except in compliance with the License.
5    * You may obtain a copy of the License at
6    *
7    *     http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  
16  package org.acegisecurity.ui.cas;
17  
18  import org.springframework.beans.factory.InitializingBean;
19  
20  
21  /***
22   * Stores properties related to this CAS service.
23   * 
24   * <P>
25   * Each web application capable of processing CAS tickets is known as a
26   * service. This class stores the properties that are relevant to the local
27   * CAS service, being the application that is being secured by the Acegi
28   * Security System for Spring.
29   * </p>
30   *
31   * @author Ben Alex
32   * @version $Id: ServiceProperties.java,v 1.3 2005/11/17 00:55:49 benalex Exp $
33   */
34  public class ServiceProperties implements InitializingBean {
35      //~ Instance fields ========================================================
36  
37      private String service;
38      private boolean sendRenew = false;
39  
40      //~ Methods ================================================================
41  
42      public void setSendRenew(boolean sendRenew) {
43          this.sendRenew = sendRenew;
44      }
45  
46      /***
47       * Indicates whether the <code>renew</code> parameter should be sent to the
48       * CAS login URL and CAS validation URL.
49       * 
50       * <p>
51       * If <code>true</code>, it will force CAS to authenticate the user again
52       * (even if the user has previously authenticated). During ticket
53       * validation it will require the ticket was generated as a consequence of
54       * an explicit login. High security applications would probably set this
55       * to <code>true</code>. Defaults to <code>false</code>, providing
56       * automated single sign on.
57       * </p>
58       *
59       * @return whether to send the <code>renew</code> parameter to CAS
60       */
61      public boolean isSendRenew() {
62          return sendRenew;
63      }
64  
65      public void setService(String service) {
66          this.service = service;
67      }
68  
69      /***
70       * Represents the service the user is authenticating to.
71       * 
72       * <p>
73       * This service is the callback URL belonging to the local Acegi Security
74       * System for Spring secured application. For example,
75       * </p>
76       * <code>https://www.mycompany.com/application/j_acegi_cas_security_check</code>
77       *
78       * @return the URL of the service the user is authenticating to
79       */
80      public String getService() {
81          return service;
82      }
83  
84      public void afterPropertiesSet() throws Exception {
85          if ((service == null) || "".equals(service)) {
86              throw new IllegalArgumentException("service must be specified");
87          }
88      }
89  }