]> git.basschouten.com Git - openhab-addons.git/blob
0c6745aaa9d97127f9cc133453d5e7fba739838e
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.ftpupload.internal.ftp;
14
15 import java.util.List;
16
17 import org.apache.ftpserver.ftplet.Authority;
18 import org.apache.ftpserver.ftplet.AuthorizationRequest;
19 import org.apache.ftpserver.ftplet.User;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22
23 /**
24  * Simple FTP user implementation.
25  *
26  *
27  * @author Pauli Anttila - Initial contribution
28  */
29 public class FTPUser implements User {
30     private static Logger logger = LoggerFactory.getLogger(FTPUser.class);
31
32     private final String login;
33     private int idleTimeout;
34
35     public FTPUser(String login, int idleTimeout) {
36         this.login = login;
37         this.idleTimeout = idleTimeout;
38     }
39
40     @Override
41     public AuthorizationRequest authorize(final AuthorizationRequest authRequest) {
42         logger.trace("authorize: {}", authRequest);
43         return authRequest;
44     }
45
46     @Override
47     public boolean getEnabled() {
48         logger.trace("getEnabled");
49         return true;
50     }
51
52     @Override
53     public String getHomeDirectory() {
54         logger.trace("getHomeDirectory");
55         return "/";
56     }
57
58     @Override
59     public int getMaxIdleTime() {
60         logger.trace("getMaxIdleTime");
61         return idleTimeout;
62     }
63
64     @Override
65     public String getName() {
66         logger.trace("getName");
67         return this.login;
68     }
69
70     @Override
71     public List<Authority> getAuthorities() {
72         logger.trace("getAuthorities");
73         return null;
74     }
75
76     @Override
77     public List<Authority> getAuthorities(Class<? extends Authority> arg0) {
78         logger.trace("getAuthorities: {}", arg0);
79         return null;
80     }
81
82     @Override
83     public String getPassword() {
84         logger.trace("getPassword");
85         return null;
86     }
87 }