View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.module.pgp;
8   
9   import org.mule.api.security.Authentication;
10  
11  import java.util.Map;
12  
13  import org.bouncycastle.openpgp.PGPPublicKey;
14  
15  public class PGPAuthentication implements Authentication
16  {
17      private boolean authenticated;
18      private String userName;
19      private Message message;
20      private PGPPublicKey publicKey;
21  
22      public PGPAuthentication(String userName, Message message)
23      {
24          this.authenticated = false;
25          this.userName = userName;
26          this.message = message;
27      }
28  
29      public void setAuthenticated(boolean b)
30      {
31          authenticated = b;
32      }
33  
34      public boolean isAuthenticated()
35      {
36          return authenticated;
37      }
38  
39      public Object getCredentials()
40      {
41          return message;
42      }
43  
44      public Object getDetails()
45      {
46          return publicKey;
47      }
48  
49      protected void setDetails(PGPPublicKey publicKey)
50      {
51          this.publicKey = publicKey;
52      }
53  
54      public Object getPrincipal()
55      {
56          return userName;
57      }
58  
59      public Map getProperties()
60      {
61          // TODO
62          return null;
63      }
64  
65      public void setProperties(Map securityMode)
66      {
67          // TODO
68  
69      }
70  }