commit | author | age
|
a8dd37
|
1 |
/* |
JM |
2 |
* Copyright 2014 gitblit.com. |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not |
|
5 |
* use this file except in compliance with the License. You may obtain a copy of |
|
6 |
* the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
|
12 |
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
|
13 |
* License for the specific language governing permissions and limitations under |
|
14 |
* the License. |
|
15 |
*/ |
|
16 |
package com.gitblit.transport.ssh; |
|
17 |
|
|
18 |
import java.net.SocketAddress; |
|
19 |
|
d41034
|
20 |
import org.apache.sshd.common.session.Session.AttributeKey; |
a8dd37
|
21 |
|
JM |
22 |
import com.gitblit.models.UserModel; |
|
23 |
|
|
24 |
/** |
|
25 |
* |
|
26 |
* @author Eric Myrhe |
|
27 |
* |
|
28 |
*/ |
|
29 |
public class SshDaemonClient { |
|
30 |
public static final AttributeKey<SshDaemonClient> KEY = new AttributeKey<SshDaemonClient>(); |
|
31 |
|
|
32 |
private final SocketAddress remoteAddress; |
|
33 |
|
|
34 |
private volatile UserModel user; |
8d96b9
|
35 |
private volatile SshKey key; |
a8dd37
|
36 |
private volatile String repositoryName; |
JM |
37 |
|
|
38 |
SshDaemonClient(SocketAddress peer) { |
|
39 |
this.remoteAddress = peer; |
|
40 |
} |
|
41 |
|
|
42 |
public SocketAddress getRemoteAddress() { |
|
43 |
return remoteAddress; |
|
44 |
} |
|
45 |
|
|
46 |
public UserModel getUser() { |
|
47 |
return user; |
|
48 |
} |
|
49 |
|
|
50 |
public void setUser(UserModel user) { |
|
51 |
this.user = user; |
|
52 |
} |
|
53 |
|
|
54 |
public String getUsername() { |
|
55 |
return user == null ? null : user.username; |
|
56 |
} |
|
57 |
|
|
58 |
public void setRepositoryName(String repositoryName) { |
|
59 |
this.repositoryName = repositoryName; |
|
60 |
} |
|
61 |
|
|
62 |
public String getRepositoryName() { |
|
63 |
return repositoryName; |
|
64 |
} |
8d96b9
|
65 |
|
JM |
66 |
public SshKey getKey() { |
|
67 |
return key; |
|
68 |
} |
|
69 |
|
|
70 |
public void setKey(SshKey key) { |
|
71 |
this.key = key; |
|
72 |
} |
|
73 |
|
a8dd37
|
74 |
} |