Class NativeAuthenticationProvider
java.lang.Object
ecmwf.common.ecaccess.NativeAuthenticationProvider
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Connected.Gets the ECuser.static NativeAuthenticationProvider
Gets the single instance of NativeAuthenticationProvider.byte[]
getNewCertificate
(String user, String passcode, String profile, String remoteHost) Gets the new certificate.String[]
getNewToken
(byte[] certificate, String profile, String remoteHost) Gets the new token.String[]
getNewToken
(String user, String passcode, String profile, String remoteHost) Gets the new token.abstract String
getRoot()
Gets the root.abstract UserSession
getUserSession
(String host, String user, ECauthToken token, String profile, Closeable closeable) Gets the user session.abstract UserSession
getUserSession
(String host, String ticket, String profile, Closeable closeable) Called if we have a ticket.abstract UserSession
Called if we have a password.boolean
isPassword
(String user, String passwordOrTicket) Allow differentiating tickets and passwords.abstract boolean
isRegistredUser
(String user) Checks if it is a registred user.newActivity
(String user, String plugin, String host, String agent, String action, String comment, boolean error) New activity.New event.static void
setProvider
(Class<?> cls) Sets the provider.boolean
If tickets are supported then the isPassword method will be called to differentiate the passwords and the tickets.
-
Constructor Details
-
NativeAuthenticationProvider
public NativeAuthenticationProvider()
-
-
Method Details
-
newActivity
public Activity newActivity(String user, String plugin, String host, String agent, String action, String comment, boolean error) New activity.- Parameters:
user
- the userplugin
- the pluginhost
- the hostagent
- the agentaction
- the actioncomment
- the commenterror
- the error- Returns:
- the activity
-
newEvent
-
getECUser
-
getRoot
-
connected
public boolean connected()Connected.- Returns:
- true, if successful
-
getNewCertificate
public byte[] getNewCertificate(String user, String passcode, String profile, String remoteHost) throws Exception Gets the new certificate.- Parameters:
user
- the userpasscode
- the passcodeprofile
- the profileremoteHost
- the remote host- Returns:
- the new certificate
- Throws:
Exception
- the exception
-
getNewToken
-
getNewToken
-
isRegistredUser
-
isPassword
Allow differentiating tickets and passwords. Depending of the result the session will be created with one getUserSession or the other.- Parameters:
user
- the userpasswordOrTicket
- the password or ticket- Returns:
- true, if it is a password
-
supportTickets
public boolean supportTickets()If tickets are supported then the isPassword method will be called to differentiate the passwords and the tickets.- Returns:
- true, if it does support tickets.
-
getUserSession
public abstract UserSession getUserSession(String host, String ticket, String profile, Closeable closeable) throws Exception Called if we have a ticket.- Parameters:
host
- the hostticket
- the ticketprofile
- the profilecloseable
- the closeable- Returns:
- the user session
- Throws:
Exception
- the exception
-
getUserSession
public abstract UserSession getUserSession(String host, String user, String password, String profile, Closeable closeable) throws Exception Called if we have a password.- Parameters:
host
- the hostuser
- the userpassword
- the passwordprofile
- the profilecloseable
- the closeable- Returns:
- the user session
- Throws:
Exception
- the exception
-
getUserSession
public abstract UserSession getUserSession(String host, String user, ECauthToken token, String profile, Closeable closeable) throws Exception Gets the user session.- Parameters:
host
- the hostuser
- the usertoken
- the tokenprofile
- the profilecloseable
- the closeable- Returns:
- the user session
- Throws:
Exception
- the exception
-
setProvider
-
getInstance
Gets the single instance of NativeAuthenticationProvider.- Returns:
- single instance of NativeAuthenticationProvider
- Throws:
IOException
- Signals that an I/O exception has occurred.
-