Jonathan Hart | 5db4453 | 2018-07-12 18:13:54 -0700 | [diff] [blame] | 1 | /* |
Joey Armstrong | 4de0b45 | 2023-01-18 15:26:54 -0500 | [diff] [blame] | 2 | * Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors |
Jonathan Hart | 5db4453 | 2018-07-12 18:13:54 -0700 | [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 | |
| 17 | package org.opencord.aaa; |
| 18 | |
| 19 | import org.onosproject.event.AbstractEvent; |
| 20 | import org.onosproject.net.ConnectPoint; |
| 21 | |
| 22 | /** |
| 23 | * Event indicating the authentication state of a port has changed. |
| 24 | */ |
| 25 | public class AuthenticationEvent extends |
| 26 | AbstractEvent<AuthenticationEvent.Type, ConnectPoint> { |
| 27 | |
| 28 | /** |
| 29 | * Authentication event type. |
| 30 | */ |
| 31 | public enum Type { |
| 32 | /** |
| 33 | * Supplicant has started authentication on a port. |
| 34 | */ |
| 35 | STARTED, |
| 36 | |
| 37 | /** |
| 38 | * Supplicant has requested authentication on a port. |
| 39 | */ |
| 40 | REQUESTED, |
| 41 | |
| 42 | /** |
| 43 | * Authentication request was approved. |
| 44 | */ |
| 45 | APPROVED, |
| 46 | |
| 47 | /** |
| 48 | * Authentication request was denied. |
| 49 | */ |
Jonathan Hart | 612651f | 2019-11-25 09:21:43 -0800 | [diff] [blame] | 50 | DENIED, |
| 51 | |
| 52 | /** |
| 53 | * Authentication flow timed out. |
| 54 | */ |
| 55 | TIMEOUT |
Jonathan Hart | 5db4453 | 2018-07-12 18:13:54 -0700 | [diff] [blame] | 56 | } |
| 57 | |
Jonathan Hart | 9d1ce80 | 2020-01-28 10:45:08 -0800 | [diff] [blame] | 58 | private AuthenticationRecord authRecord; |
| 59 | |
Jonathan Hart | 5db4453 | 2018-07-12 18:13:54 -0700 | [diff] [blame] | 60 | /** |
| 61 | * Creates a new authentication event. |
| 62 | * |
| 63 | * @param type event type |
| 64 | * @param connectPoint port |
| 65 | */ |
| 66 | public AuthenticationEvent(Type type, ConnectPoint connectPoint) { |
| 67 | super(type, connectPoint); |
| 68 | } |
| 69 | |
Jonathan Hart | 9d1ce80 | 2020-01-28 10:45:08 -0800 | [diff] [blame] | 70 | /** |
| 71 | * Creates a new authentication event. |
| 72 | * |
| 73 | * @param type event type |
| 74 | * @param connectPoint port |
| 75 | * @param record information about the authentication state |
| 76 | */ |
| 77 | public AuthenticationEvent(Type type, ConnectPoint connectPoint, AuthenticationRecord record) { |
| 78 | super(type, connectPoint); |
| 79 | this.authRecord = record; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Gets information about the authentication state. |
| 84 | * |
| 85 | * @return authentication record |
| 86 | */ |
| 87 | public AuthenticationRecord authenticationRecord() { |
| 88 | return this.authRecord; |
| 89 | } |
| 90 | |
Jonathan Hart | 5db4453 | 2018-07-12 18:13:54 -0700 | [diff] [blame] | 91 | } |