org.restlet.security.Verifier Java Examples
The following examples show how to use
org.restlet.security.Verifier.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AuthenticationVerifier.java From vicinity-gateway-api with GNU General Public License v3.0 | 5 votes |
/** * Overridden method from super class. */ @Override public int verify(Request request, Response response) { ChallengeResponse cr = request.getChallengeResponse(); if (cr == null){ logger.info("Missing credentials in request from a client with IP " + request.getClientInfo().getAddress() + "."); return Verifier.RESULT_MISSING; } String objectId = cr.getIdentifier(); String password = new String(cr.getSecret()); if (communicationManager.isConnected(objectId)){ // if the client is already connected, just verify the password if (!communicationManager.verifyPassword(objectId, password)){ logger.info("Invalid credentials in request from a client with IP " + request.getClientInfo().getAddress() + "."); return Verifier.RESULT_INVALID; } } else { // if not, establish a connection StatusMessage statusMessage = communicationManager.establishConnection(objectId, password); if (statusMessage.isError()){ logger.info("Invalid credentials in request from a client with IP " + request.getClientInfo().getAddress() + "."); return Verifier.RESULT_INVALID; } } logger.info("Valid credentials received from a client with IP " + request.getClientInfo().getAddress() + "."); return Verifier.RESULT_VALID; }
Example #2
Source File: RestComponent.java From microservices-comparison with Apache License 2.0 | 5 votes |
@Inject public RestComponent(@Hello Application helloApp, @Car Application carApp, Verifier authTokenVerifier) { getClients().add(Protocol.HTTPS); Server secureServer = getServers().add(Protocol.HTTPS, 8043); Series<Parameter> parameters = secureServer.getContext().getParameters(); parameters.add("sslContextFactory", "org.restlet.engine.ssl.DefaultSslContextFactory"); parameters.add("keyStorePath", System.getProperty("javax.net.ssl.keyStorePath")); getDefaultHost().attach("/api/hello", secure(helloApp, authTokenVerifier, "ame")); getDefaultHost().attach("/api/cars", secure(carApp, authTokenVerifier, "ame")); replaceConverter(JacksonConverter.class, new JacksonCustomConverter()); }
Example #3
Source File: RestComponent.java From microservices-comparison with Apache License 2.0 | 5 votes |
private Restlet secure(Application app, Verifier verifier, String realm) { ChallengeAuthenticator guard = new ChallengeAuthenticator(getContext().createChildContext(), ChallengeScheme.HTTP_OAUTH_BEARER, realm); guard.setVerifier(verifier); guard.setNext(app); return guard; }
Example #4
Source File: PolygeneRestApplication.java From attic-polygene-java with Apache License 2.0 | 5 votes |
@Override public Restlet createInboundRoot() { Context context = getContext(); Engine.getInstance().getRegisteredConverters().add( new PolygeneConverter( objectFactory ) ); if( polygeneApplication.mode() == Application.Mode.development ) { setDebugging( true ); } router = new Router( context ); addRoutes( router ); router.attach( basePath, newPolygeneRestlet( EntryPointResource.class, EntryPoint.class ) ); Verifier verifier = createVerifier(); Enroler enroler = createEnroler(); if( verifier == null && enroler == null ) { return createInterceptors(new Filter() { } ); } else { ChallengeAuthenticator guard = new ChallengeAuthenticator( context, ChallengeScheme.HTTP_BASIC, getName() + " Realm" ); if( verifier != null ) { guard.setVerifier( verifier ); } if( enroler != null ) { guard.setEnroler( enroler ); } return createInterceptors( guard ); } }
Example #5
Source File: RestletInfraModule.java From microservices-comparison with Apache License 2.0 | 4 votes |
@Override protected void configure() { bind(Verifier.class).to(AuthTokenVerifier.class); }
Example #6
Source File: PolygeneRestApplication.java From attic-polygene-java with Apache License 2.0 | 4 votes |
protected Verifier createVerifier() { return null; }