View Javadoc

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