Giter Club home page Giter Club logo

Comments (2)

edwardzjl avatar edwardzjl commented on July 30, 2024

I think the simplest way is to check whether current user has already logged in when handling oidc-callback, and skip the authentication flow if the user is already logged in.

But the redirection will be lost anyway, we can only rely on afterLoginRedirectURL:

func (s *server) callback(w http.ResponseWriter, r *http.Request) {
	...
	// check current session
	if session, err := s.store.Get(r, userSessionCookie); err != nil {
		logger.Errorf("Failed to get session: %v", err)
	} else if !session.IsNew {
		// session already exists, which means the user already logged in
		destination := ""
		if s.afterLoginRedirectURL != "" {
			// Redirect to a predefined url from config.
			afterLoginRedirectURL := mustParseURL(s.afterLoginRedirectURL)
			destination = afterLoginRedirectURL.String()
		}
		logger.WithField("redirectTo", destination).
		Info("User already logged in, redirecting.")
		http.Redirect(w, r, destination, http.StatusFound)
		return
	}
	...

from oidc-authservice.

deepakdeore2004 avatar deepakdeore2004 commented on July 30, 2024

any chance to have progress on this?

from oidc-authservice.

Related Issues (20)

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.