blob: e2a24bc3d62c187b97e046f0b95835a9a0a413e1 [file] [log] [blame]
Ari Saha89831742015-06-26 10:31:48 -07001/*
Amit Ghoshc9ac1e52017-07-28 12:31:18 +01002 * Copyright 2017-present Open Networking Foundation
Ari Saha89831742015-06-26 10:31:48 -07003 *
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
alshabib6d527452016-06-01 18:00:47 -070018package org.opencord.aaa;
Ari Saha89831742015-06-26 10:31:48 -070019
Jonathan Hart4731dd92018-05-02 17:30:05 -070020import com.google.common.collect.Maps;
Ari Saha89831742015-06-26 10:31:48 -070021import org.onlab.packet.MacAddress;
22import org.onosproject.net.ConnectPoint;
Ari Saha89831742015-06-26 10:31:48 -070023import org.slf4j.Logger;
Thomas Vachuskae9894202015-07-30 11:59:07 -070024
Jonathan Hart4731dd92018-05-02 17:30:05 -070025import java.util.Map;
Ari Saha89831742015-06-26 10:31:48 -070026
27import static org.slf4j.LoggerFactory.getLogger;
28
29/**
30 * AAA Finite State Machine.
31 */
32
33class StateMachine {
34 //INDEX to identify the state in the transition table
35 static final int STATE_IDLE = 0;
36 static final int STATE_STARTED = 1;
37 static final int STATE_PENDING = 2;
38 static final int STATE_AUTHORIZED = 3;
39 static final int STATE_UNAUTHORIZED = 4;
40
41 //INDEX to identify the transition in the transition table
42 static final int TRANSITION_START = 0; // --> started
43 static final int TRANSITION_REQUEST_ACCESS = 1;
44 static final int TRANSITION_AUTHORIZE_ACCESS = 2;
45 static final int TRANSITION_DENY_ACCESS = 3;
46 static final int TRANSITION_LOGOFF = 4;
47
Amit Ghoshc9ac1e52017-07-28 12:31:18 +010048 private static int identifier = -1;
Ari Saha89831742015-06-26 10:31:48 -070049 private byte challengeIdentifier;
50 private byte[] challengeState;
51 private byte[] username;
52 private byte[] requestAuthenticator;
53
54 // Supplicant connectivity info
Ray Milkeyf61a24e2015-09-24 16:34:02 -070055 private ConnectPoint supplicantConnectpoint;
56 private MacAddress supplicantAddress;
57 private short vlanId;
Amit Ghoshc9ac1e52017-07-28 12:31:18 +010058 private byte priorityCode;
Ari Saha89831742015-06-26 10:31:48 -070059
60 private String sessionId = null;
61
62 private final Logger log = getLogger(getClass());
63
64
65 private State[] states = {
66 new Idle(), new Started(), new Pending(), new Authorized(), new Unauthorized()
67 };
68
69
70 //State transition table
71 /*
72
73 state IDLE | STARTED | PENDING | AUTHORIZED | UNAUTHORIZED
74 ////
75 input
76 ----------------------------------------------------------------------------------------------------
77
ke han04e47f32016-10-28 14:15:43 +080078 START STARTED | _ | _ | STARTED | STARTED
Ari Saha89831742015-06-26 10:31:48 -070079
80 REQUEST_ACCESS _ | PENDING | _ | _ | _
81
82 AUTHORIZE_ACCESS _ | _ | AUTHORIZED | _ | _
83
84 DENY_ACCESS _ | - | UNAUTHORIZED | _ | _
85
86 LOGOFF _ | _ | _ | IDLE | IDLE
87 */
88
89 private int[] idleTransition =
90 {STATE_STARTED, STATE_IDLE, STATE_IDLE, STATE_IDLE, STATE_IDLE};
91 private int[] startedTransition =
92 {STATE_STARTED, STATE_PENDING, STATE_STARTED, STATE_STARTED, STATE_STARTED};
93 private int[] pendingTransition =
94 {STATE_PENDING, STATE_PENDING, STATE_AUTHORIZED, STATE_UNAUTHORIZED, STATE_PENDING};
95 private int[] authorizedTransition =
Qianqian Hu0c349812016-02-15 17:25:22 +080096 {STATE_STARTED, STATE_AUTHORIZED, STATE_AUTHORIZED, STATE_AUTHORIZED, STATE_IDLE};
Ari Saha89831742015-06-26 10:31:48 -070097 private int[] unauthorizedTransition =
ke han04e47f32016-10-28 14:15:43 +080098 {STATE_STARTED, STATE_UNAUTHORIZED, STATE_UNAUTHORIZED, STATE_UNAUTHORIZED, STATE_IDLE};
Ari Saha89831742015-06-26 10:31:48 -070099
100 //THE TRANSITION TABLE
101 private int[][] transition =
102 {idleTransition, startedTransition, pendingTransition, authorizedTransition,
103 unauthorizedTransition};
104
105 private int currentState = STATE_IDLE;
106
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700107 // Maps of state machines. Each state machine is represented by an
108 // unique identifier on the switch: dpid + port number
109 private static Map<String, StateMachine> sessionIdMap;
110 private static Map<Integer, StateMachine> identifierMap;
Ari Saha89831742015-06-26 10:31:48 -0700111
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700112 public static void initializeMaps() {
113 sessionIdMap = Maps.newConcurrentMap();
114 identifierMap = Maps.newConcurrentMap();
Amit Ghoshc9ac1e52017-07-28 12:31:18 +0100115 identifier = -1;
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700116 }
117
118 public static void destroyMaps() {
119 sessionIdMap = null;
120 identifierMap = null;
121 }
122
Qianqian Hu61a6a402016-02-16 15:18:05 +0800123 public static Map<String, StateMachine> sessionIdMap() {
124 return sessionIdMap;
125 }
126
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700127 public static StateMachine lookupStateMachineById(byte identifier) {
128 return identifierMap.get((int) identifier);
129 }
130
131 public static StateMachine lookupStateMachineBySessionId(String sessionId) {
132 return sessionIdMap.get(sessionId);
Amit Ghoshc9ac1e52017-07-28 12:31:18 +0100133 }
134
135 public static void deleteStateMachineMapping(StateMachine machine) {
136 identifierMap.entrySet().removeIf(e -> e.getValue().equals(machine));
137 }
138
139 /**
David K. Bainbridge62019492017-07-28 17:02:10 -0700140 * Deletes authentication state machine records for a given MAC address.
141 * @param mac mac address of the suppliant who's state machine should be removed
142 */
143 public static void deleteByMac(MacAddress mac) {
144
145 // Walk the map from session IDs to state machines looking for a MAC match
146 for (Map.Entry<String, StateMachine> e : sessionIdMap.entrySet()) {
147
148 // If a MAC match is found then delete the entry from the session ID
149 // and identifier map as well as call delete identifier to clean up
150 // the identifier bit set.
151 if (e.getValue() != null && e.getValue().supplicantAddress != null &&
152 e.getValue().supplicantAddress.equals(mac)) {
153 sessionIdMap.remove(e.getValue().sessionId);
154 if (e.getValue().identifier != -1) {
155 deleteStateMachineMapping(e.getValue());
156 }
157 break;
158 }
159 }
160 }
161
162 /**
Jonathan Hart932bedc2018-07-12 13:46:09 -0700163 * Creates a new StateMachine with the given session ID.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700164 *
Jonathan Hart932bedc2018-07-12 13:46:09 -0700165 * @param sessionId session Id represented by the switch dpid + port number
Ari Saha89831742015-06-26 10:31:48 -0700166 */
Jonathan Hart932bedc2018-07-12 13:46:09 -0700167 public StateMachine(String sessionId) {
168 log.info("Creating a new state machine for {}", sessionId);
Ari Saha89831742015-06-26 10:31:48 -0700169 this.sessionId = sessionId;
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700170 sessionIdMap.put(sessionId, this);
Ari Saha89831742015-06-26 10:31:48 -0700171 }
172
173 /**
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700174 * Gets the connect point for the supplicant side.
175 *
176 * @return supplicant connect point
177 */
178 public ConnectPoint supplicantConnectpoint() {
179 return supplicantConnectpoint;
180 }
181
182 /**
183 * Sets the supplicant side connect point.
184 *
185 * @param supplicantConnectpoint supplicant select point.
186 */
187 public void setSupplicantConnectpoint(ConnectPoint supplicantConnectpoint) {
188 this.supplicantConnectpoint = supplicantConnectpoint;
189 }
190
191 /**
192 * Gets the MAC address of the supplicant.
193 *
194 * @return supplicant MAC address
195 */
196 public MacAddress supplicantAddress() {
197 return supplicantAddress;
198 }
199
200 /**
201 * Sets the supplicant MAC address.
202 *
203 * @param supplicantAddress new supplicant MAC address
204 */
205 public void setSupplicantAddress(MacAddress supplicantAddress) {
206 this.supplicantAddress = supplicantAddress;
207 }
208
209 /**
210 * Gets the client's Vlan ID.
211 *
212 * @return client vlan ID
213 */
214 public short vlanId() {
215 return vlanId;
216 }
217
218 /**
219 * Sets the client's vlan ID.
220 *
221 * @param vlanId new client vlan ID
222 */
223 public void setVlanId(short vlanId) {
224 this.vlanId = vlanId;
225 }
226
227 /**
Amit Ghoshc9ac1e52017-07-28 12:31:18 +0100228 * Gets the client's priority Code.
229 *
230 * @return client Priority code
231 */
232 public byte priorityCode() {
233 return priorityCode;
234 }
235
236 /**
237 * Sets the client's priority Code.
238 *
239 * @param priorityCode new client priority Code
240 */
241 public void setPriorityCode(byte priorityCode) {
242 this.priorityCode = priorityCode;
243 }
244
245 /**
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700246 * Gets the client id that is requesting for access.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700247 *
Ari Saha89831742015-06-26 10:31:48 -0700248 * @return The client id.
249 */
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700250 public String sessionId() {
Ari Saha89831742015-06-26 10:31:48 -0700251 return this.sessionId;
252 }
253
254 /**
Ari Saha89831742015-06-26 10:31:48 -0700255 * Set the challenge identifier and the state issued by the RADIUS.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700256 *
Ari Saha89831742015-06-26 10:31:48 -0700257 * @param challengeIdentifier The challenge identifier set into the EAP packet from the RADIUS message.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700258 * @param challengeState The challenge state from the RADIUS.
Ari Saha89831742015-06-26 10:31:48 -0700259 */
260 protected void setChallengeInfo(byte challengeIdentifier, byte[] challengeState) {
261 this.challengeIdentifier = challengeIdentifier;
262 this.challengeState = challengeState;
263 }
Thomas Vachuskae9894202015-07-30 11:59:07 -0700264
Ari Saha89831742015-06-26 10:31:48 -0700265 /**
266 * Set the challenge identifier issued by the RADIUS on the access challenge request.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700267 *
Ari Saha89831742015-06-26 10:31:48 -0700268 * @param challengeIdentifier The challenge identifier set into the EAP packet from the RADIUS message.
269 */
270 protected void setChallengeIdentifier(byte challengeIdentifier) {
271 log.info("Set Challenge Identifier to {}", challengeIdentifier);
272 this.challengeIdentifier = challengeIdentifier;
273 }
274
275 /**
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700276 * Gets the challenge EAP identifier set by the RADIUS.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700277 *
Ari Saha89831742015-06-26 10:31:48 -0700278 * @return The challenge EAP identifier.
279 */
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700280 protected byte challengeIdentifier() {
Ari Saha89831742015-06-26 10:31:48 -0700281 return this.challengeIdentifier;
282 }
283
284
285 /**
286 * Set the challenge state info issued by the RADIUS.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700287 *
Ari Saha89831742015-06-26 10:31:48 -0700288 * @param challengeState The challenge state from the RADIUS.
289 */
290 protected void setChallengeState(byte[] challengeState) {
291 log.info("Set Challenge State");
292 this.challengeState = challengeState;
293 }
294
295 /**
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700296 * Gets the challenge state set by the RADIUS.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700297 *
Ari Saha89831742015-06-26 10:31:48 -0700298 * @return The challenge state.
299 */
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700300 protected byte[] challengeState() {
Ari Saha89831742015-06-26 10:31:48 -0700301 return this.challengeState;
302 }
303
304 /**
305 * Set the username.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700306 *
Ari Saha89831742015-06-26 10:31:48 -0700307 * @param username The username sent to the RADIUS upon access request.
308 */
309 protected void setUsername(byte[] username) {
310 this.username = username;
311 }
312
Ari Saha89831742015-06-26 10:31:48 -0700313 /**
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700314 * Gets the username.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700315 *
Ari Saha89831742015-06-26 10:31:48 -0700316 * @return The requestAuthenticator.
317 */
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700318 protected byte[] requestAuthenticator() {
Ari Saha89831742015-06-26 10:31:48 -0700319 return this.requestAuthenticator;
320 }
321
322 /**
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700323 * Sets the authenticator.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700324 *
Ari Saha89831742015-06-26 10:31:48 -0700325 * @param authenticator The username sent to the RADIUS upon access request.
326 */
327 protected void setRequestAuthenticator(byte[] authenticator) {
328 this.requestAuthenticator = authenticator;
329 }
330
331
332 /**
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700333 * Gets the username.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700334 *
Ari Saha89831742015-06-26 10:31:48 -0700335 * @return The username.
336 */
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700337 protected byte[] username() {
Ari Saha89831742015-06-26 10:31:48 -0700338 return this.username;
339 }
340
341 /**
342 * Return the identifier of the state machine.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700343 *
Ari Saha89831742015-06-26 10:31:48 -0700344 * @return The state machine identifier.
345 */
Amit Ghoshc9ac1e52017-07-28 12:31:18 +0100346 public synchronized byte identifier() {
347 identifier = (identifier + 1) % 255;
348 identifierMap.put(identifier, this);
349 return (byte) identifier;
Ari Saha89831742015-06-26 10:31:48 -0700350 }
351
Ari Saha89831742015-06-26 10:31:48 -0700352 /**
353 * Move to the next state.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700354 *
Ray Milkey78e95a42015-09-24 08:36:45 -0700355 * @param msg message
Ari Saha89831742015-06-26 10:31:48 -0700356 */
Thomas Vachuskae9894202015-07-30 11:59:07 -0700357 private void next(int msg) {
Ari Saha89831742015-06-26 10:31:48 -0700358 currentState = transition[currentState][msg];
359 log.info("Current State " + currentState);
360 }
361
362 /**
363 * Client has requested the start action to allow network access.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700364 *
365 * @throws StateMachineException if authentication protocol is violated
Ari Saha89831742015-06-26 10:31:48 -0700366 */
367 public void start() throws StateMachineException {
Ray Milkey78e95a42015-09-24 08:36:45 -0700368 states[currentState].start();
369 //move to the next state
370 next(TRANSITION_START);
Amit Ghoshc9ac1e52017-07-28 12:31:18 +0100371 identifier = this.identifier();
Ari Saha89831742015-06-26 10:31:48 -0700372 }
373
374 /**
375 * An Identification information has been sent by the supplicant.
376 * Move to the next state if possible.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700377 *
378 * @throws StateMachineException if authentication protocol is violated
Ari Saha89831742015-06-26 10:31:48 -0700379 */
380 public void requestAccess() throws StateMachineException {
Ray Milkey78e95a42015-09-24 08:36:45 -0700381 states[currentState].requestAccess();
382 //move to the next state
383 next(TRANSITION_REQUEST_ACCESS);
Ari Saha89831742015-06-26 10:31:48 -0700384 }
385
386 /**
387 * RADIUS has accepted the identification.
388 * Move to the next state if possible.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700389 *
390 * @throws StateMachineException if authentication protocol is violated
Ari Saha89831742015-06-26 10:31:48 -0700391 */
392 public void authorizeAccess() throws StateMachineException {
Ray Milkey78e95a42015-09-24 08:36:45 -0700393 states[currentState].radiusAccepted();
394 //move to the next state
395 next(TRANSITION_AUTHORIZE_ACCESS);
Ari Saha89831742015-06-26 10:31:48 -0700396
Jonathan Hart932bedc2018-07-12 13:46:09 -0700397 // TODO send state machine change event
Ari Saha89831742015-06-26 10:31:48 -0700398
Amit Ghoshc9ac1e52017-07-28 12:31:18 +0100399 // Clear mapping
400 deleteStateMachineMapping(this);
Ari Saha89831742015-06-26 10:31:48 -0700401 }
402
403 /**
404 * RADIUS has denied the identification.
405 * Move to the next state if possible.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700406 *
407 * @throws StateMachineException if authentication protocol is violated
Ari Saha89831742015-06-26 10:31:48 -0700408 */
409 public void denyAccess() throws StateMachineException {
Ray Milkey78e95a42015-09-24 08:36:45 -0700410 states[currentState].radiusDenied();
411 //move to the next state
412 next(TRANSITION_DENY_ACCESS);
Amit Ghoshc9ac1e52017-07-28 12:31:18 +0100413 // Clear mappings
414 deleteStateMachineMapping(this);
Ari Saha89831742015-06-26 10:31:48 -0700415 }
416
417 /**
418 * Logoff request has been requested.
419 * Move to the next state if possible.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700420 *
421 * @throws StateMachineException if authentication protocol is violated
Ari Saha89831742015-06-26 10:31:48 -0700422 */
423 public void logoff() throws StateMachineException {
Ray Milkey78e95a42015-09-24 08:36:45 -0700424 states[currentState].logoff();
425 //move to the next state
426 next(TRANSITION_LOGOFF);
Ari Saha89831742015-06-26 10:31:48 -0700427 }
428
429 /**
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700430 * Gets the current state.
Thomas Vachuskae9894202015-07-30 11:59:07 -0700431 *
Ari Saha89831742015-06-26 10:31:48 -0700432 * @return The current state. Could be STATE_IDLE, STATE_STARTED, STATE_PENDING, STATE_AUTHORIZED,
433 * STATE_UNAUTHORIZED.
434 */
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700435 public int state() {
Ari Saha89831742015-06-26 10:31:48 -0700436 return currentState;
437 }
438
Ray Milkeyf61a24e2015-09-24 16:34:02 -0700439 @Override
Ari Saha89831742015-06-26 10:31:48 -0700440 public String toString() {
441 return ("sessionId: " + this.sessionId) + "\t" + ("identifier: " + this.identifier) + "\t" +
442 ("state: " + this.currentState);
443 }
Ari Saha89831742015-06-26 10:31:48 -0700444
Ray Milkey78e95a42015-09-24 08:36:45 -0700445 abstract class State {
446 private final Logger log = getLogger(getClass());
Thomas Vachuskae9894202015-07-30 11:59:07 -0700447
Ray Milkey78e95a42015-09-24 08:36:45 -0700448 private String name = "State";
Ari Saha89831742015-06-26 10:31:48 -0700449
Ray Milkey78e95a42015-09-24 08:36:45 -0700450 public void start() throws StateMachineInvalidTransitionException {
451 log.warn("START transition from this state is not allowed.");
452 }
Ari Saha89831742015-06-26 10:31:48 -0700453
Ray Milkey78e95a42015-09-24 08:36:45 -0700454 public void requestAccess() throws StateMachineInvalidTransitionException {
455 log.warn("REQUEST ACCESS transition from this state is not allowed.");
456 }
457
458 public void radiusAccepted() throws StateMachineInvalidTransitionException {
459 log.warn("AUTHORIZE ACCESS transition from this state is not allowed.");
460 }
461
462 public void radiusDenied() throws StateMachineInvalidTransitionException {
463 log.warn("DENY ACCESS transition from this state is not allowed.");
464 }
465
466 public void logoff() throws StateMachineInvalidTransitionException {
467 log.warn("LOGOFF transition from this state is not allowed.");
468 }
Ari Saha89831742015-06-26 10:31:48 -0700469 }
Thomas Vachuskae9894202015-07-30 11:59:07 -0700470
Ray Milkey78e95a42015-09-24 08:36:45 -0700471 /**
472 * Idle state: supplicant is logged of from the network.
473 */
474 class Idle extends State {
475 private final Logger log = getLogger(getClass());
476 private String name = "IDLE_STATE";
477
478 public void start() {
479 log.info("Moving from IDLE state to STARTED state.");
480 }
Ari Saha89831742015-06-26 10:31:48 -0700481 }
Thomas Vachuskae9894202015-07-30 11:59:07 -0700482
Ray Milkey78e95a42015-09-24 08:36:45 -0700483 /**
484 * Started state: supplicant has entered the network and informed the authenticator.
485 */
486 class Started extends State {
487 private final Logger log = getLogger(getClass());
488 private String name = "STARTED_STATE";
489
490 public void requestAccess() {
491 log.info("Moving from STARTED state to PENDING state.");
492 }
Ari Saha89831742015-06-26 10:31:48 -0700493 }
Thomas Vachuskae9894202015-07-30 11:59:07 -0700494
Ray Milkey78e95a42015-09-24 08:36:45 -0700495 /**
496 * Pending state: supplicant has been identified by the authenticator but has not access yet.
497 */
498 class Pending extends State {
499 private final Logger log = getLogger(getClass());
500 private String name = "PENDING_STATE";
501
502 public void radiusAccepted() {
503 log.info("Moving from PENDING state to AUTHORIZED state.");
504 }
505
506 public void radiusDenied() {
507 log.info("Moving from PENDING state to UNAUTHORIZED state.");
508 }
Ari Saha89831742015-06-26 10:31:48 -0700509 }
Thomas Vachuskae9894202015-07-30 11:59:07 -0700510
Ray Milkey78e95a42015-09-24 08:36:45 -0700511 /**
512 * Authorized state: supplicant port has been accepted, access is granted.
513 */
514 class Authorized extends State {
515 private final Logger log = getLogger(getClass());
516 private String name = "AUTHORIZED_STATE";
Ari Saha89831742015-06-26 10:31:48 -0700517
Qianqian Hu0c349812016-02-15 17:25:22 +0800518 public void start() {
519 log.info("Moving from AUTHORIZED state to STARTED state.");
520 }
521
Ray Milkey78e95a42015-09-24 08:36:45 -0700522 public void logoff() {
Ari Saha89831742015-06-26 10:31:48 -0700523
Ray Milkey78e95a42015-09-24 08:36:45 -0700524 log.info("Moving from AUTHORIZED state to IDLE state.");
525 }
Ari Saha89831742015-06-26 10:31:48 -0700526 }
527
Ray Milkey78e95a42015-09-24 08:36:45 -0700528 /**
529 * Unauthorized state: supplicant port has been rejected, access is denied.
530 */
531 class Unauthorized extends State {
532 private final Logger log = getLogger(getClass());
533 private String name = "UNAUTHORIZED_STATE";
534
ke han04e47f32016-10-28 14:15:43 +0800535 public void start() {
536 log.info("Moving from UNAUTHORIZED state to STARTED state.");
537 }
538
Ray Milkey78e95a42015-09-24 08:36:45 -0700539 public void logoff() {
540 log.info("Moving from UNAUTHORIZED state to IDLE state.");
541 }
Ari Saha89831742015-06-26 10:31:48 -0700542 }
Ari Saha89831742015-06-26 10:31:48 -0700543
544
Ari Saha89831742015-06-26 10:31:48 -0700545}