View Javadoc

1   // ========================================================================
2   // Copyright (c) 2008-2009 Mort Bay Consulting Pty. Ltd.
3   // ------------------------------------------------------------------------
4   // All rights reserved. This program and the accompanying materials
5   // are made available under the terms of the Eclipse Public License v1.0
6   // and Apache License v2.0 which accompanies this distribution.
7   // The Eclipse Public License is available at 
8   // http://www.eclipse.org/legal/epl-v10.html
9   // The Apache License v2.0 is available at
10  // http://www.opensource.org/licenses/apache2.0.php
11  // You may elect to redistribute this code under either of these licenses. 
12  // ========================================================================
13  
14  
15  package org.eclipse.jetty.security.jaspi.callback;
16  
17  import javax.security.auth.Subject;
18  import javax.security.auth.callback.Callback;
19  
20  import org.eclipse.jetty.http.security.Credential;
21  
22  /**
23   * CredentialValidationCallback
24   *
25   * Store a jetty Credential for a user so that it can be
26   * validated by jaspi
27   */
28  public class CredentialValidationCallback implements Callback
29  {
30      private Credential _credential;
31      private boolean _result;
32      private Subject _subject;
33      private String _userName;
34      
35      
36      public CredentialValidationCallback (Subject subject, String userName, Credential credential)
37      {
38          _subject = subject;
39          _userName = userName;
40          _credential = credential;
41      }
42      
43      public Credential getCredential ()
44      {
45          return _credential;
46      }
47      
48      public void clearCredential ()
49      {
50          _credential = null;
51      } 
52      
53      public boolean getResult()
54      {
55          return _result;
56      }
57      
58      public javax.security.auth.Subject getSubject()
59      {
60          return _subject;
61      }
62      
63      public java.lang.String getUsername()
64      {
65          return _userName;     
66      }
67      
68      public void setResult(boolean result)
69      {
70          _result = result;
71      }
72      
73      
74  }