View Javadoc

1   /*
2    * $Id: PGPAuthentication.java 10789 2008-02-12 20:04:43Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.module.pgp;
12  
13  import org.mule.api.security.Authentication;
14  
15  import java.util.Map;
16  
17  import cryptix.message.Message;
18  import cryptix.pki.KeyBundle;
19  
20  public class PGPAuthentication implements Authentication
21  {
22      boolean authenticated = false;
23      private String userName;
24      private Message message;
25      private KeyBundle userKeyBundle = null;
26  
27      public PGPAuthentication(String userName, Message message)
28      {
29          this.userName = userName;
30          this.message = message;
31      }
32  
33      /*
34       * (non-Javadoc)
35       * 
36       * @see org.mule.api.security.Authentication#setAuthenticated(boolean)
37       */
38      public void setAuthenticated(boolean b)
39      {
40          authenticated = b;
41      }
42  
43      /*
44       * (non-Javadoc)
45       * 
46       * @see org.mule.api.security.Authentication#isAuthenticated()
47       */
48      public boolean isAuthenticated()
49      {
50          return authenticated;
51      }
52  
53      /*
54       * (non-Javadoc)
55       * 
56       * @see org.mule.api.security.Authentication#getCredentials()
57       */
58      public Object getCredentials()
59      {
60          return message;
61      }
62  
63      /*
64       * (non-Javadoc)
65       * 
66       * @see org.mule.api.security.Authentication#getDetails()
67       */
68      public Object getDetails()
69      {
70          return userKeyBundle;
71      }
72  
73      protected void setDetails(KeyBundle kb)
74      {
75          userKeyBundle = kb;
76      }
77  
78      /*
79       * (non-Javadoc)
80       * 
81       * @see org.mule.api.security.Authentication#getPrincipal()
82       */
83      public Object getPrincipal()
84      {
85          return userName;
86      }
87  
88      public Map getProperties()
89      {
90          // TODO
91          return null;
92      }
93  
94      public void setProperties(Map securityMode)
95      {
96          // TODO
97  
98      }
99  
100 }