Interface ZitiContext
-
- All Implemented Interfaces:
public interface ZitiContextObject representing an instantiated Ziti identity. Its main purpose is to instantiate
connections to Ziti services
binding for hosting Ziti services in the app
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumZitiContext.ServiceUpdatepublic final classZitiContext.ServiceEventpublic classZitiContext.Status
-
Method Summary
Modifier and Type Method Description abstract Stringname()abstract BooleanisEnabled()abstract UnitsetEnabled(Boolean v)abstract Future<Unit>onStatus(Consumer<ZitiContext.Status> consumer)register for status updates. abstract ZitiContext.StatusgetStatus()abstract StateFlow<ZitiContext.Status>statusUpdates()abstract Future<Unit>onServiceEvent(Consumer<ZitiContext.ServiceEvent> consumer)register for service updates. abstract Flow<ZitiContext.ServiceEvent>serviceUpdates()abstract Flow<IdentityDetail>getIdentity()abstract IdentityDetailgetId()abstract ServiceDetailgetService(InetSocketAddress addr)abstract ServiceDetailgetService(String name)abstract ServiceDetailgetService(String name, Long timeout)abstract ServiceDetailgetService(InetSocketAddress addr, Long timeout)abstract Collection<TerminatorClientDetail>getServiceTerminators(ServiceDetail service)abstract ZitiConnectiondial(String serviceName)connect to Ziti service. abstract ZitiConnectiondial(ZitiAddress.Dial dialAddr)abstract ZitiConnectiondialSuspend(ZitiAddress.Dial dialAddr)abstract Socketconnect(String host, Integer port)connect to Ziti service identified by intercept host and port. abstract AsynchronousSocketChannelopen()creates unconnected AsynchronousSocketChannel. abstract AsynchronousServerSocketChannelopenServer()creates unbound AsynchronousServerSocketChannel. abstract Unitdestroy()abstract BooleanisMFAEnrolled()abstract UnitauthenticateMFA(String code)abstract DetailMfaenrollMFA()abstract CompletionStage<DetailMfa>enrollMFAAsync()abstract UnitverifyMFA(String code)abstract CompletionStage<Unit>verifyMFAAsync(String code)abstract UnitremoveMFA(String code)abstract CompletionStage<Unit>removeMFAAsync(String code)abstract Array<String>getMFARecoveryCodes(String code, Boolean newCodes)abstract CompletionStage<Array<String>>getMFARecoveryCodesAsync(String code, Boolean newCodes)abstract Unitdump(Writer writer)-
-
Method Detail
-
setEnabled
abstract Unit setEnabled(Boolean v)
-
onStatus
abstract Future<Unit> onStatus(Consumer<ZitiContext.Status> consumer)
register for status updates.
The resulting future never completes, unless cancelled or the context is destroyed.
- Parameters:
consumer- callback to be called on status change- Returns:
future that can be cancelled to stop receiving updates
-
getStatus
abstract ZitiContext.Status getStatus()
-
statusUpdates
abstract StateFlow<ZitiContext.Status> statusUpdates()
-
onServiceEvent
abstract Future<Unit> onServiceEvent(Consumer<ZitiContext.ServiceEvent> consumer)
register for service updates.
The resulting future never completes, unless cancelled or the context is destroyed.
- Parameters:
consumer- callback to be called on service change- Returns:
future that can be cancelled to stop receiving updates
-
serviceUpdates
abstract Flow<ZitiContext.ServiceEvent> serviceUpdates()
-
getIdentity
abstract Flow<IdentityDetail> getIdentity()
-
getId
abstract IdentityDetail getId()
-
getService
abstract ServiceDetail getService(InetSocketAddress addr)
-
getService
abstract ServiceDetail getService(String name)
-
getService
abstract ServiceDetail getService(String name, Long timeout)
-
getService
abstract ServiceDetail getService(InetSocketAddress addr, Long timeout)
-
getServiceTerminators
abstract Collection<TerminatorClientDetail> getServiceTerminators(ServiceDetail service)
-
dial
abstract ZitiConnection dial(String serviceName)
connect to Ziti service.
-
dial
abstract ZitiConnection dial(ZitiAddress.Dial dialAddr)
-
dialSuspend
abstract ZitiConnection dialSuspend(ZitiAddress.Dial dialAddr)
-
connect
abstract Socket connect(String host, Integer port)
connect to Ziti service identified by intercept host and port.
- Parameters:
host- intercept hostnameport- intercept port- Returns:
connection adapted to standard Socket
-
open
abstract AsynchronousSocketChannel open()
creates unconnected AsynchronousSocketChannel.
before it can be used it has to be connected, via any standard AsynchronousSocketChannel.connect method with ZitiAddress.Dial address.
val con = zitiCtx.open() con.connect(ZitiAddress.Service(serviceName)).get()- Returns:
unconnected connection adapted to AsynchronousSocketChannel
-
openServer
abstract AsynchronousServerSocketChannel openServer()
creates unbound AsynchronousServerSocketChannel.
before it can be used to accept ziti client connections it has to be bound to Ziti service via any standard AsynchronousServerSocketChannel.bind method with ZitiAddress.Bind address all standard AsynchronousServerSocketChannel.accept methods are supported.
Example:
val server = zitiCtx.openServer() server.bind(ZitiAddress.Service(serviceName)) // start accepting val clt = service.accept().get()- Returns:
unbound AsynchronousServerSocketChannel
-
isMFAEnrolled
abstract Boolean isMFAEnrolled()
-
authenticateMFA
abstract Unit authenticateMFA(String code)
-
enrollMFA
abstract DetailMfa enrollMFA()
-
enrollMFAAsync
abstract CompletionStage<DetailMfa> enrollMFAAsync()
-
verifyMFAAsync
abstract CompletionStage<Unit> verifyMFAAsync(String code)
-
removeMFAAsync
abstract CompletionStage<Unit> removeMFAAsync(String code)
-
getMFARecoveryCodes
abstract Array<String> getMFARecoveryCodes(String code, Boolean newCodes)
-
getMFARecoveryCodesAsync
abstract CompletionStage<Array<String>> getMFARecoveryCodesAsync(String code, Boolean newCodes)
-
-
-
-