Skip to content

Defining Websocket rules on Oathkeeper #896

Answered by Benehiko
Benehiko asked this question in Q&A
Discussion options

You must be logged in to vote

It is possible to pass along the connection through Oathkeeper using WebSockets, but it will only authenticate the cookie on the first connection.

Example:

I have a gin server that is hosting some apis

[GIN-debug] GET    /                         --> main.main.func1 (3 handlers)
[GIN-debug] GET    /auth                     --> main.main.func2 (3 handlers)
[GIN-debug] GET    /ws                       --> main.main.func3 (3 handlers)

The /ws path is my WebSocket path

Note some of the below code is taken from these source 1, source 2

package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"github.com/gorilla/websocket"
)

func main() {

	r := gin.Default()
	r.LoadHTMLFiles("index.html")

	r.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@fakegermano
Comment options

@aeneasr
Comment options

@Benehiko
Comment options

@vinckr
Comment options

Answer selected by Benehiko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants