All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.oauth2.client.TokenChangeObservable Maven / Gradle / Ivy

The newest version!
/* 
 * Copyright (c) 2017 Georgi Pavlov ([email protected]).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the MIT license which accompanies 
 * this distribution, and is available at 
 * https://github.com/tengia/oauth-2/blob/master/LICENSE
 */

package net.oauth2.client;

import net.oauth2.AccessToken;

/**
 * Functional capability to install listeners for token updates and support
 * asynchronous push notification on changes.
 *
 * @param 
 */
public interface TokenChangeObservable {

	/**
	 * Subscribes an observer to notification upon Access Token changes.
	 * 
	 * @param tokenChangeObserver
	 *            {@link TokenChangeObserver} subscriber for token changes. A
	 *            lambda expression, inner class or normal class implementing
	 *            the interface are all suitable arguments:
	 * 			  
	 *            attach(new TokenChangeObserver<>(){
	 *            	 public void tokenChanged(TemporalAccessToken newToken, TemporalAccessToken oldToken){
	 *            		System.out.println(newToken + ":" + oldToken);
	 *            	 }
	 *            });
	 *            
*
	 *            attach((newToken, oldToken) -> System.out.println(newToken + ":" + oldToken));
	 *            
*/ TokenChangeObservable attach(TokenChangeObserver tokenChangeObserver); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy