GithubHelp home page GithubHelp logo

isabella232 / kafka-connect-http-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from confluentinc/kafka-connect-http-demo

0.0 0.0 0.0 83 KB

A demo target for running the Confluent HTTP sink connector

License: Apache License 2.0

Dockerfile 3.96% Java 96.04%

kafka-connect-http-demo's Introduction

Kafka Connect HTTP Sink Demo App

NOTICE: This app is for demo purposes only and is not suitable for production use.

A Spring Boot app that can run with various types of auth configured by setting the appropriate Spring Profile.

This app is useful in testing the HTTP Sink Connector.

Supported Security Types

  • Simple Auth (No Authentication) (Profile: simple-auth)
  • Basic Auth (Profile: basic-auth)
  • OAuth2 (Profile: oauth2)
  • SSL (Profile: ssl-auth)

Simple (No) Auth

  1. Set profile

    SPRING_PROFILES_ACTIVE=simple-auth
    
  2. Run the app

  3. Call any endpoint

    # create a message
    curl -X POST \
      http://localhost:8080/api/messages \
      -d message-goes-here
      
    # get all messages
    curl -X POST http://localhost:8080/api/messages

Basic Auth

  1. Set profile

    SPRING_PROFILES_ACTIVE=basic-auth
    
  2. Run the app

  3. Call endpoints with Basic Auth Header

    # create a message
    curl -X POST \
      http://localhost:8080/api/messages \
      -H 'Authorization: Basic YWRtaW46cGFzc3dvcmQ='
      -d message-goes-here
    
    # get all messages
    curl -X POST \
      http://localhost:8080/api/messages \
      -H 'Authorization: Basic YWRtaW46cGFzc3dvcmQ='

OAuth2

  1. Set profile

    SPRING_PROFILES_ACTIVE=oauth2
    
  2. Run the app

  3. Create Token

    curl -X POST \
      http://localhost:8080/oauth/token \
      -H 'Content-Type: application/x-www-form-urlencoded' \
      -H 'Authorization: Basic a2MtY2xpZW50OmtjLXNlY3JldA==' \
      -d 'grant_type=client_credentials&scope=any'
  4. Use Token (substitute {token} with value from previous step)

    # create a message
    curl -X POST \
      http://localhost:8080/api/messages \
      -H 'Authorization: Bearer {token}'
      -d message-goes-here
      
    curl -X GET \
        http://localhost:8080/api/messages \
        -H 'Authorization: Bearer {token}'
    

SSL

  1. Set profile
    SPRING_PROFILES_ACTIVE=ssl-auth
    
  2. Use cert in root of project to call endpoints

Notes:

  • port 8443 is used instead of 8080
  • Keystore was generated with this command:
     keytool -genkeypair -alias tomcat -keyalg RSA -keysize 2048 
    -keystore keystore.jks -validity 3650

kafka-connect-http-demo's People

Contributors

javabrett avatar rhauch avatar schroedermatt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.