RapidPM Vaadin Component - Login

Dependencies for the RapidPM projects

License

License

Categories

Categories

Vaadin User Interface Web Frameworks
GroupId

GroupId

org.rapidpm.vaadin
ArtifactId

ArtifactId

vaadin-component-login
Last Version

Last Version

00.07.04-RPM
Release Date

Release Date

Type

Type

jar
Description

Description

RapidPM Vaadin Component - Login
Dependencies for the RapidPM projects
Project URL

Project URL

https://github.com/vaadin-developer/vaadin-component-login
Project Organization

Project Organization

Sven Ruppert
Source Code Management

Source Code Management

https://github.com/vaadin-developer/vaadin-component-login

Download vaadin-component-login

How to add to project

<!-- https://jarcasting.com/artifacts/org.rapidpm.vaadin/vaadin-component-login/ -->
<dependency>
    <groupId>org.rapidpm.vaadin</groupId>
    <artifactId>vaadin-component-login</artifactId>
    <version>00.07.04-RPM</version>
</dependency>
// https://jarcasting.com/artifacts/org.rapidpm.vaadin/vaadin-component-login/
implementation 'org.rapidpm.vaadin:vaadin-component-login:00.07.04-RPM'
// https://jarcasting.com/artifacts/org.rapidpm.vaadin/vaadin-component-login/
implementation ("org.rapidpm.vaadin:vaadin-component-login:00.07.04-RPM")
'org.rapidpm.vaadin:vaadin-component-login:jar:00.07.04-RPM'
<dependency org="org.rapidpm.vaadin" name="vaadin-component-login" rev="00.07.04-RPM">
  <artifact name="vaadin-component-login" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.rapidpm.vaadin', module='vaadin-component-login', version='00.07.04-RPM')
)
libraryDependencies += "org.rapidpm.vaadin" % "vaadin-component-login" % "00.07.04-RPM"
[org.rapidpm.vaadin/vaadin-component-login "00.07.04-RPM"]

Dependencies

compile (10)

Group / Artifact Type Version
org.rapidpm : rapidpm-dependencies-core-logger jar 04.00.05-RPM
org.rapidpm : rapidpm-functional-reactive jar 00.07.04-RPM
org.rapidpm : testbench-ng-m-framework-v10 jar
org.apache.meecrowave : meecrowave-core jar 1.2.3
org.apache.meecrowave : meecrowave-specs-api jar 1.2.3
com.vaadin : vaadin jar
com.vaadin : vaadin-lumo-theme jar
commons-io : commons-io jar 2.6
org.slf4j : slf4j-api jar 1.7.25
org.slf4j : slf4j-simple jar 1.7.25

test (8)

Group / Artifact Type Version
org.rapidpm : testbench-ng-m-container-init-meecrowave jar
org.rapidpm : testbench-ng-m-pageobject-vaadin-generic jar
org.rapidpm : testbench-ng-m-pageobject-vaadin-v10-tb jar
com.vaadin : vaadin-testbench-core jar
org.junit.jupiter : junit-jupiter-api jar 5.1.1
org.junit.jupiter : junit-jupiter-params jar 5.1.1
org.junit.platform : junit-platform-launcher jar 1.1.1
org.junit.jupiter : junit-jupiter-engine jar 5.1.1

Project Modules

There are no modules declared in this project.

RapidPM Vaadin Component - Login

A simple Login Screen - boring but usefull ;-) This is for Vaadin 10, build on a JDK10 but with

    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>

Why?

A Login Screen is often used, and a repetive task to create if you are creating smaller apps, demos, and so on.

For this I created the component, da work with dependencies instead of copy-paste. even in my examples.

How it looks like ?

_data/RapidPM_Vaadin_Component-Login.gif

How?

You can use this as a dependency. The only thing you have to do is to create the the connection to your app.

Step 1 - connect to your Auth - Service

The first method to create is the method with the name public abstract boolean checkCredentials();

Here you have to decide if the provided credentials are valid or not. In the demo/test Source folder you will find the class MyLoginView The implementation in this class is for demo usage only.

  @Override
  public boolean checkCredentials() {
    String username = username();
    String password = password();

    // USE Apache Shiro for example : demo you can find here
    // https://github.com/Nano-Vaadin-Demos/nano-vaadin-meecrowave-shiro-V10

    // DON NOT USE THIS IN PRODUCTION !!
    boolean isOK = username != null && username.equals("admin") ||
                   password != null && password.equals("admin");

    UI.getCurrent().getSession().setAttribute(LOGGED_IN, isOK);
    // DON NOT USE THIS IN PRODUCTION !!

    return isOK;
  }

Step 2 - what to do if auth failed

Define what should happen if the Auth-Service will reject the provided credentials. In this example there will be a Notification shown and a logger message created.

  @Override
  public void reactOnFailedLogin() {
    logger().warning("Login is not acctepd..");
    Notification.show("Credentials not accepted..");
  }

Step 3 - what to do if auth is OK

Now we can redirect to the next View. In this example a demo view with no special meaning.

  @Override
  public void navigateToApp() {
    UI.getCurrent().navigate(MainView.class);
  }

Demo Usage

In the test folders you will find a fully working demo app to show a dummy implementation. If you want to see samo more examples, for example how to use this with Shiro, have a look at https://github.com/Nano-Vaadin-Demos/nano-vaadin-meecrowave-shiro-V10

ROADMAP

  • I18n will be added
  • TDD / PageObjects based on Testbench NG and jUnit5

How to connect?

Feel free to ping me ..

  • email sven.ruppert (a) gmail.com
  • Twitter - @SvenRuppert
org.rapidpm.vaadin

Vaadin Developer

Jumpstarts and HowTos for Vaadin based projects

Versions

Version
00.07.04-RPM