import {Ice} from 'ice'; import '../Ice/Router'; import {Glacier2} from '../Glacier2/Session'; import '../Glacier2/PermissionsVerifier'; declare module './Glacier2.ns' { /** * Glacier2 is a firewall solution for Ice. Glacier2 authenticates * and filters client requests and allows callbacks to the client in a * secure fashion. In combination with IceSSL, Glacier2 provides a * security solution that is both non-intrusive and easy to configure. */ namespace Glacier2 { /** * This exception is raised if a client tries to destroy a session * with a router, but no session exists for the client. * * @see Router#destroySession */ class SessionNotExistException extends Ice.UserException {} /** * The Glacier2 specialization of the Ice::Router interface. */ abstract class Router extends Ice.Object implements Ice.Router { /** * Get the router's client proxy, i.e., the proxy to use for * forwarding requests from the client to the router. * * If a null proxy is returned, the client will forward requests * to the router's endpoints. * * @param hasRoutingTable Indicates whether or not the router supports a routing * table. If it is supported, the Ice runtime will call addProxies to populate the * routing table. This out parameter is only supported starting with Ice 3.7. * The Ice runtime assumes the router has a routing table if the optional is not * set. * * @return The router's client proxy. */ abstract getClientProxy( current: Ice.Current, ): Ice.OperationResult<[Ice.ObjectPrx | null, boolean | undefined]>; /** * Get the router's server proxy, i.e., the proxy to use for * forwarding requests from the server to the router. * * @return The router's server proxy. */ abstract getServerProxy( current: Ice.Current, ): Ice.OperationResult; /** * Add new proxy information to the router's routing table. * * @param proxies The proxies to add. * * @return Proxies discarded by the router. */ abstract addProxies( proxies: Ice.ObjectProxySeq, current: Ice.Current, ): Ice.OperationResult; /** * This category must be used in the identities of all of the client's * callback objects. This is necessary in order for the router to * forward callback requests to the intended client. If the Glacier2 * server endpoints are not set, the returned category is an empty * string. * * @return The category. */ abstract getCategoryForClient( current: Ice.Current, ): Ice.OperationResult; /** * Create a per-client session with the router. If a * {@link SessionManager} has been installed, a proxy to a {@link Session} * object is returned to the client. Otherwise, null is returned * and only an internal session (i.e., not visible to the client) * is created. * * If a session proxy is returned, it must be configured to route * through the router that created it. This will happen automatically * if the router is configured as the client's default router at the * time the session proxy is created in the client process, otherwise * the client must configure the session proxy explicitly. * * @see Session * @see SessionManager * @see PermissionsVerifier * * @return A proxy for the newly created session, or null if no * {@link SessionManager} has been installed. * * @param userId The user id for which to check the password. * * @param password The password for the given user id. * * @throws PermissionDeniedException Raised if the password for * the given user id is not correct, or if the user is not allowed * access. * * @throws CannotCreateSessionException Raised if the session * cannot be created. */ abstract createSession( userId: string, password: string, current: Ice.Current, ): Ice.OperationResult; /** * Create a per-client session with the router. The user is * authenticated through the SSL certificates that have been * associated with the connection. If a {@link SessionManager} has been * installed, a proxy to a {@link Session} object is returned to the * client. Otherwise, null is returned and only an internal * session (i.e., not visible to the client) is created. * * If a session proxy is returned, it must be configured to route * through the router that created it. This will happen automatically * if the router is configured as the client's default router at the * time the session proxy is created in the client process, otherwise * the client must configure the session proxy explicitly. * * @see Session * @see SessionManager * @see PermissionsVerifier * * @return A proxy for the newly created session, or null if no * {@link SessionManager} has been installed. * * @throws PermissionDeniedException Raised if the user cannot be * authenticated or if the user is not allowed access. * * @throws CannotCreateSessionException Raised if the session * cannot be created. */ abstract createSessionFromSecureConnection( current: Ice.Current, ): Ice.OperationResult; /** * Keep the calling client's session with this router alive. * * @throws SessionNotExistException Raised if no session exists * for the calling client. */ abstract refreshSession(current: Ice.Current): Ice.OperationResult; /** * Destroy the calling client's session with this router. * * @throws SessionNotExistException Raised if no session exists * for the calling client. */ abstract destroySession(current: Ice.Current): Ice.OperationResult; /** * Get the value of the session timeout. Sessions are destroyed * if they see no activity for this period of time. * * @return The timeout (in seconds). */ abstract getSessionTimeout( current: Ice.Current, ): Ice.OperationResult; /** * Get the value of the ACM timeout. Clients supporting connection * heartbeats can enable them instead of explicitly sending keep * alives requests. * * NOTE: This method is only available since Ice 3.6. * * @return The timeout (in seconds). */ abstract getACMTimeout(current: Ice.Current): Ice.OperationResult; } /** * The Glacier2 specialization of the Ice::Router interface. */ class RouterPrx extends Ice.ObjectPrx implements Ice.RouterPrx { /** * Get the router's client proxy, i.e., the proxy to use for * forwarding requests from the client to the router. * * If a null proxy is returned, the client will forward requests * to the router's endpoints. * * @param hasRoutingTable Indicates whether or not the router supports a routing * table. If it is supported, the Ice runtime will call addProxies to populate the * routing table. This out parameter is only supported starting with Ice 3.7. * The Ice runtime assumes the router has a routing table if the optional is not * set. * * @return The router's client proxy. */ getClientProxy( ctx?: Ice.Context, ): Ice.AsyncResult<[Ice.ObjectPrx | null, boolean | undefined]>; /** * Get the router's server proxy, i.e., the proxy to use for * forwarding requests from the server to the router. * * @return The router's server proxy. */ getServerProxy(ctx?: Ice.Context): Ice.AsyncResult; /** * Add new proxy information to the router's routing table. * * @param proxies The proxies to add. * * @return Proxies discarded by the router. */ addProxies( proxies: Ice.ObjectProxySeq, ctx?: Ice.Context, ): Ice.AsyncResult; /** * This category must be used in the identities of all of the client's * callback objects. This is necessary in order for the router to * forward callback requests to the intended client. If the Glacier2 * server endpoints are not set, the returned category is an empty * string. * * @return The category. */ getCategoryForClient(ctx?: Ice.Context): Ice.AsyncResult; /** * Create a per-client session with the router. If a * {@link SessionManager} has been installed, a proxy to a {@link Session} * object is returned to the client. Otherwise, null is returned * and only an internal session (i.e., not visible to the client) * is created. * * If a session proxy is returned, it must be configured to route * through the router that created it. This will happen automatically * if the router is configured as the client's default router at the * time the session proxy is created in the client process, otherwise * the client must configure the session proxy explicitly. * * @see Session * @see SessionManager * @see PermissionsVerifier * * @return A proxy for the newly created session, or null if no * {@link SessionManager} has been installed. * * @param userId The user id for which to check the password. * * @param password The password for the given user id. * * @throws PermissionDeniedException Raised if the password for * the given user id is not correct, or if the user is not allowed * access. * * @throws CannotCreateSessionException Raised if the session * cannot be created. */ createSession( userId: string, password: string, ctx?: Ice.Context, ): Ice.AsyncResult; /** * Create a per-client session with the router. The user is * authenticated through the SSL certificates that have been * associated with the connection. If a {@link SessionManager} has been * installed, a proxy to a {@link Session} object is returned to the * client. Otherwise, null is returned and only an internal * session (i.e., not visible to the client) is created. * * If a session proxy is returned, it must be configured to route * through the router that created it. This will happen automatically * if the router is configured as the client's default router at the * time the session proxy is created in the client process, otherwise * the client must configure the session proxy explicitly. * * @see Session * @see SessionManager * @see PermissionsVerifier * * @return A proxy for the newly created session, or null if no * {@link SessionManager} has been installed. * * @throws PermissionDeniedException Raised if the user cannot be * authenticated or if the user is not allowed access. * * @throws CannotCreateSessionException Raised if the session * cannot be created. */ createSessionFromSecureConnection( ctx?: Ice.Context, ): Ice.AsyncResult; /** * Keep the calling client's session with this router alive. * * @throws SessionNotExistException Raised if no session exists * for the calling client. */ refreshSession(ctx?: Ice.Context): Ice.AsyncResult; /** * Destroy the calling client's session with this router. * * @throws SessionNotExistException Raised if no session exists * for the calling client. */ destroySession(ctx?: Ice.Context): Ice.AsyncResult; /** * Get the value of the session timeout. Sessions are destroyed * if they see no activity for this period of time. * * @return The timeout (in seconds). */ getSessionTimeout(ctx?: Ice.Context): Ice.AsyncResult; /** * Get the value of the ACM timeout. Clients supporting connection * heartbeats can enable them instead of explicitly sending keep * alives requests. * * NOTE: This method is only available since Ice 3.6. * * @return The timeout (in seconds). */ getACMTimeout(ctx?: Ice.Context): Ice.AsyncResult; } } } export {Glacier2} from './Glacier2.ns';