Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7788387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:59:00+00:00 2026-06-01T20:59:00+00:00

I am totally new to Netty and Java, but this afternoon I have managed

  • 0

I am totally new to Netty and Java, but this afternoon I have managed to create a chat server based on the Netty telnet sample. It works great and I have ‘/’ slash commands working so people can do things like set their name which I currently store in ctx->setAttachment(name).

I have a back end database server I want to connect them with so I can get their name this way, but I’ll need to add authentication each user first. I know I could do that with more slash commands. But I wanted to see if I could do it using a handler in the event chain. Have a handler that checks if a user is authenticated and if they are not, does the logic for authenticating them. And then somehow stores they are authenticated. And if they are authenticated, it lets my current chat handler do its work instead.

Can anyone please provide some links or tips for doing this? My knowledge with Netty is very very basic right now. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:59:02+00:00Added an answer on June 1, 2026 at 8:59 pm

    It really depends.. You can for example have a custom SimpleChannelUpstreamHandler that handle the authentication and remove it once its done.

    Something like this:

    public class AuthHandler extends SimpleChannelUpstreamHandler {
    
        @Override
        public void messageReceived( ChannelHandlerContext ctx, MessageEvent e) throws Exception {
            if (auth(e)) {
                // remove handler after auth was done
                ctx.getPipeline().remove(this);
            }
        }
    
        // Returns true if auth was successfully
        private boolean auth(MessageEvent e) {
            ....
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm totally new to both java and java Server worlds... But I've a good
I'm totally new to Flex (moving away from Java for now :(). I have
Totally new to Cake. I have this table named Content and another one named
Totally new to Spring & Java development but working on a project for a
Totally new to python, and i want to do the following: I have this
I'm totally new to GreaseMonkey, but I'm trying to make a little script. //
Totally new to Drupal so be gentle please! Let's say I have a number
This is a totally new area for me so please be patient. I want
I'm totally new on this so I want to start with something simple. I
Totally new to Linux, have an Arch Linux machine up. What is the command

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.