View Javadoc

1   /*
2    * $Id: PGPAuthentication.java 20310 2010-11-24 10:40:35Z esteban.robles $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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 org.bouncycastle.openpgp.PGPPublicKey;
18  
19  public class PGPAuthentication implements Authentication
20  {
21      private boolean authenticated;
22      private String userName;
23      private Message message;
24      private PGPPublicKey publicKey;
25  
26      public PGPAuthentication(String userName, Message message)
27      {
28          this.authenticated = false;
29          this.userName = userName;
30          this.message = message;
31      }
32  
33      public void setAuthenticated(boolean b)
34      {
35          authenticated = b;
36      }
37  
38      public boolean isAuthenticated()
39      {
40          return authenticated;
41      }
42  
43      public Object getCredentials()
44      {
45          return message;
46      }
47  
48      public Object getDetails()
49      {
50          return publicKey;
51      }
52  
53      protected void setDetails(PGPPublicKey publicKey)
54      {
55          this.publicKey = publicKey;
56      }
57  
58      public Object getPrincipal()
59      {
60          return userName;
61      }
62  
63      public Map getProperties()
64      {
65          // TODO
66          return null;
67      }
68  
69      public void setProperties(Map securityMode)
70      {
71          // TODO
72  
73      }
74  }