User authorization in Java using Spring, Swing and SQLite - java

I am create Java Swing application using Spring. I am creating two user one admin second general. There are mainly five function or menu button in my application.
For admin user I want to show all five menu button, and for general user only four.
I have created logging window, getting username and password from SQLite.
I searched on the web and found Apache Shiro and JAAS. But I have to do this urgently, and to use that framework will need more time.
Is there any simple Java code to do this? Any example similar to my problem?

No need to look very far ,
you just need to query is it type 1 or type 2 user using simple table column mechnism and hide not necessary components

Related

ReactJS profiles

I am trying to understand if it is possible to use profiles like Java Spring profiles on ReactJS.
I mean, in case I developed a dashboard for many different customers, and want a core code for all of them, and by demand of one of the customers, add the part he wants only for him (only him will see this). Is it possible to achieve this on ReactJS?
Yes, it's possible to show users certain pages-components and allow them to navigate to certain routes.
You need authentication to distinguish between users with some roles "Backend server that generates the user's tokens and assign them roles or 3rd party service"
I suggest you using Redux with your react app, and once the user log-in you dispatch an action with the current user role
Once you dispatched the action all the components that connected to redux will be notified and your conditions that show/hide things will work properly

With Java EE and GWT, how can I open a new browser tab to a web app on the same server?

I have a web app that displays a list of ID's (among other things) to the user. The back end is Java EE, and the front end is built with GWT.
When the user clicks one of the ID's a callback is executed that queries additional parameters from an API using the ID. When the API returns the parameters, I want to open another web app, passing one of the parameters to it so it opens displaying information relating to that parameter. How would this normally be done?
Can I use something like LinkElement for this?
Edit: I got this working using GWT's Window.open("my.url.com");
But I'm wondering if there's a better way?
You need to use GWT's Window class to handle this.

Eclipse RCP authentication

I would like to know how to implement authentication in Eclipse RCP. I have started an app and I have two views, one for admin and one for a regular user. At startup I want to show the login dialog and depending of type of user to show a view. Can anyone tell me which is the best way to do that? Thanks!
I'll suggest you that create a single view for both admin and regular user . Just create different widgets for the admin and regular user . Before creating the view just hook the Login Dialog and on the basis of authentication from the login dialog load the widgets in the view .
There are many different ways to do this :-)
I usually recommend using activities as these are completely independent of the code for the view, perspectives, commands, etc.
See this blog entry on how to set-up the activities.

setup Login System and privilege and permission for Java

I'm trying to make a java program that prompt Login for the user and then some options and actions in the program will be available depend on the user permission. so for example , some user can print the picture other can not.
I'm sure this thing have been done many times. I'm looking for a tutorial or code sample to start with. I search in the interent but I couldn't find anything useful. Please help me
Thank you
and then some options and actions in the program will be available depend on the user permission
Design and build your GUI usings Actions. The Actions can be used to create your menu items and toolbar buttons.
Then, after the user is logged in you can disable the Action if the user doesn't have the permission to use that particular function.
Using this approach, the menu items and toolbar buttons will still appear in the UI, however they will be disabled so the user won't be able to use them.
You may want to look at Acegi http://www.acegisecurity.org/ , which is a java library that provides features for authorization.
Without Acegi Security (if you don't use it). First you must define all components from your application and save it to database. And then, create some tables such as role, user_role and role_components and components. Then when login, you must query this tables and check a security role from table role_components :)
CMIIW

Netbeans Java Desktop Database application with login connecting to users from mysql

I wanted to create a java desktop database application with the combination of the login window so that I will be able to display the user different types of options depending on their level assigned by mysql db. For example, some users may just have add rows privilege to specified tables and read on all others only. Is there any built in login swing window in netbeans?
Not in the default JDK, but there are third party libs that have them. I have used SwingLabs Login Form before and it has worked nicely for me.

Categories

Resources