001/* 002 * Copyright (c) 2013 - 2016 TDP Ltd All Rights Reserved. 003 * TDP Ltd grants permission, free of charge, to any person obtaining copies 004 * of this software and its associated documentation files (the "Software"), 005 * to deal in the Software without restriction, including to use, copy, adapt, 006 * publish, distribute, display, perform, sublicense, and sell copies of the 007 * Software, subject to the following condition: You must include the above 008 * copyright notice and this permission notice in all full or partial copies 009 * of the Software. 010 * 011 * TDP LTD PROVIDES THE SOFTWARE "AS IS," WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, 012 * INCLUDING WITHOUT THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 013 * PARTICULAR PURPOSE, AND NON-INFRINGMENT. TDP LTD, THE AUTHORS OF THE SOFTWARE, 014 * AND THE OWNERS OF COPYRIGHT IN THE SOFTWARE ARE NOT LIABLE FOR ANY CLAIM, DAMAGES, 015 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING 016 * FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 017 * THE SOFTWARE. 018 */ 019package cz.tdp.kshield.notification; 020 021import cz.tdp.kshield.client.UserInfo; 022 023 024/** 025 * 026 */ 027public interface KShieldAuthManager 028{ 029 /** 030 * Call this after successfull kshield authentication 031 * @param userInfo 032 */ 033 void addAuth(UserInfo userInfo); 034 035 /** 036 * Call this after denied kshield authentication from given ip address 037 * @param ipAddress 038 */ 039 void removeAuth(String ipAddress); 040 041 /** 042 * Remove all info about authentication from given ip address 043 * @param ipAddress 044 */ 045 void resetAuth(String ipAddress); 046 047 /** 048 * Register custom handler called after successful kshield authentication 049 * @param handler 050 */ 051 void registerOnLoginHandler(AuthChangeHandler handler); 052 053 /** 054 * Register custom handler called after kshield authentication removal 055 * @param handler 056 */ 057 void registerOnLogoutHandler(AuthChangeHandler handler); 058 059 /** 060 * This method checks kshield server if authentication info is missing 061 * 062 * @param ipAddress 063 * @param userID 064 * @return true if userID is authenticated by kshield from given ip address 065 */ 066 boolean hasAuth(String ipAddress, String userID); 067 068 /** 069 * Call this after establishing connection with WebSocket Endpoint 070 * 071 * @param ipAddress 072 * @param ws WebSocket Endpoint instance 073 */ 074 void addEndpoint(String ipAddress, KShieldEndpoint ws); 075 076 /** 077 * IMPORTANT: Call this after closing connection with WebSocket Endpoint 078 * 079 * @param ipAddress 080 * @param ws WebSocket Endpoint instance 081 */ 082 void removeEndpoint(String ipAddress, KShieldEndpoint ws); 083 084 /** 085 * @param ipAddress 086 * @param kshieldUserID userID returned by KeyShield SSO server 087 * @param authenticated user is authenticated 088 * @return 089 */ 090 String poll(String ipAddress, String kshieldUserID, boolean authenticated); 091}