blob: a0d099f1fb0d24d3442679819c172c397d20dd1a [file] [log] [blame]
Jonathan Hart612651f2019-11-25 09:21:43 -08001/*
2 * Copyright 2020-present Open Networking Foundation
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
17package org.opencord.aaa;
18
19import org.onlab.packet.MacAddress;
20import org.onosproject.net.ConnectPoint;
21
22/**
23 * Describes state of an authentication attempt.
24 */
25public class AuthenticationRecord {
26
27 private final ConnectPoint supplicantConnectPoint;
28
29 private final byte[] username;
30
31 private final MacAddress supplicantAddress;
32
33 private final String state;
34
Jonathan Hart9d1ce802020-01-28 10:45:08 -080035 private final long lastChanged;
36
Jonathan Hart612651f2019-11-25 09:21:43 -080037 /**
38 * Creates a new authentication record.
39 *
40 * @param supplicantConnectPoint connect point
41 * @param username user name
42 * @param supplicantAddress MAC address of supplicant
43 * @param state authentication state
Jonathan Hart9d1ce802020-01-28 10:45:08 -080044 * @param lastChanged timestamp of latest activity
Jonathan Hart612651f2019-11-25 09:21:43 -080045 */
46 public AuthenticationRecord(ConnectPoint supplicantConnectPoint, byte[] username,
Jonathan Hart9d1ce802020-01-28 10:45:08 -080047 MacAddress supplicantAddress, String state, long lastChanged) {
Jonathan Hart612651f2019-11-25 09:21:43 -080048 this.supplicantConnectPoint = supplicantConnectPoint;
49 this.username = username;
50 this.supplicantAddress = supplicantAddress;
51 this.state = state;
Jonathan Hart9d1ce802020-01-28 10:45:08 -080052 this.lastChanged = lastChanged;
Jonathan Hart612651f2019-11-25 09:21:43 -080053 }
54
55 /**
56 * Gets the connect point of supplicant.
57 *
58 * @return connect point
59 */
60 public ConnectPoint supplicantConnectPoint() {
61 return supplicantConnectPoint;
62 }
63
64 /**
65 * Gets the username of supplicant.
66 *
67 * @return username
68 */
69 public byte[] username() {
70 return username;
71 }
72
73 /**
74 * Gets the MAC address of the supplicant.
75 *
76 * @return MAC address
77 */
78 public MacAddress supplicantAddress() {
79 return supplicantAddress;
80 }
81
82 /**
83 * Gets the current state of the authentication attempt.
84 *
85 * @return state
86 */
87 public String state() {
88 return state;
89 }
Jonathan Hart9d1ce802020-01-28 10:45:08 -080090
91 /**
92 * Gets the timestamp of the last activity on this authentication.
93 *
94 * @return timestamp
95 */
96 public long lastChanged() {
97 return lastChanged;
98 }
Jonathan Hart612651f2019-11-25 09:21:43 -080099}