Brian Stanke | 9bf8d7c | 2016-02-11 10:17:23 -0500 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Brian Stanke | 9bf8d7c | 2016-02-11 10:17:23 -0500 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of 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, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Claudine Chiu | 31ad527 | 2016-02-17 20:56:24 +0000 | [diff] [blame] | 17 | package org.onosproject.net.key; |
Brian Stanke | 9bf8d7c | 2016-02-11 10:17:23 -0500 | [diff] [blame] | 18 | |
| 19 | /** |
| 20 | * Representation of a username and password. |
| 21 | */ |
| 22 | public final class UsernamePassword extends DeviceKey { |
| 23 | private final String username; |
| 24 | private final String password; |
| 25 | |
| 26 | /** |
| 27 | * Private constructor for a username and password. |
| 28 | * |
| 29 | * @param username user's name |
| 30 | * @param password user's password |
| 31 | */ |
| 32 | private UsernamePassword(String username, String password) { |
| 33 | this.username = username; |
| 34 | this.password = password; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Static method to construct a username / password. |
| 39 | * |
| 40 | * @param username user's name |
| 41 | * @param password user's password |
| 42 | * @return username and password |
| 43 | */ |
| 44 | static UsernamePassword usernamePassword(String username, String password) { |
| 45 | return new UsernamePassword(username, password); |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Returns the username. |
| 50 | * |
| 51 | * @return username |
| 52 | */ |
| 53 | public String username() { |
| 54 | return username; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Returns the password. |
| 59 | * |
| 60 | * @return password |
| 61 | */ |
| 62 | public String password() { |
| 63 | return password; |
| 64 | } |
| 65 | } |