Skip to content

Commit

Permalink
Merge pull request #135 from arjantijms/master
Browse files Browse the repository at this point in the history
Reverted master back to 1.0 API
  • Loading branch information
arjantijms authored Jul 22, 2019
2 parents 1e2e2f8 + 10c8688 commit d7ac24f
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 478 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Principal that represents the caller principal associated with the invocation being
* processed by the container (e.g. the current HTTP request).
*/
public class CallerPrincipal implements Principal, Serializable {
public class CallerPrincipal implements Principal {

private static final long serialVersionUID = -6951555039431667786L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.enterprise.util.AnnotationLiteral;
import javax.interceptor.InterceptorBinding;

/**
Expand Down Expand Up @@ -57,18 +56,5 @@
@Retention(RUNTIME)
@Target(TYPE)
public @interface AutoApplySession {

/**
* A default literal for the {@link AutoApplySession} annotation.
*
* @since 1.1
*/
@SuppressWarnings("all")
public final static class Literal extends AnnotationLiteral<AutoApplySession> implements AutoApplySession {

private static final long serialVersionUID = 1L;

public static final Literal INSTANCE = new Literal();

}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.enterprise.util.AnnotationLiteral;
import javax.enterprise.util.Nonbinding;
import javax.interceptor.InterceptorBinding;

Expand Down Expand Up @@ -53,91 +52,6 @@
@Target(TYPE)
public @interface LoginToContinue {

/**
* A default literal type for the {@link LoginToContinue} annotation.
*
* @since 1.1
*/
@SuppressWarnings("all")
public final static class Literal extends AnnotationLiteral<LoginToContinue> implements LoginToContinue {

private static final long serialVersionUID = 1L;

private final String loginPage;
private final boolean useForwardToLogin;
private final String useForwardToLoginExpression;
private final String errorPage;

public static LiteralBuilder builder() {
return new LiteralBuilder();
}

public static class LiteralBuilder {

private String loginPage = "/login";
private boolean useForwardToLogin = true;
private String useForwardToLoginExpression;
private String errorPage = "/login-error";

public LiteralBuilder loginPage (String loginPage) {
this.loginPage = loginPage;
return this;
}

public LiteralBuilder useForwardToLogin (boolean useForwardToLogin) {
this.useForwardToLogin = useForwardToLogin;
return this;
}

public LiteralBuilder useForwardToLoginExpression (String useForwardToLoginExpression) {
this.useForwardToLoginExpression = useForwardToLoginExpression;
return this;
}

public LiteralBuilder errorPage (String errorPage) {
this.errorPage = errorPage;
return this;
}

public Literal build() {
return new Literal(
loginPage,
useForwardToLogin,
useForwardToLoginExpression,
errorPage);
}

}

public Literal(String loginPage, boolean useForwardToLogin, String useForwardToLoginExpression, String errorPage) {
this.loginPage = loginPage;
this.useForwardToLogin = useForwardToLogin;
this.useForwardToLoginExpression = useForwardToLoginExpression;
this.errorPage = errorPage;
}

@Override
public String loginPage() {
return loginPage;
}

@Override
public boolean useForwardToLogin() {
return useForwardToLogin;
}

@Override
public String useForwardToLoginExpression() {
return useForwardToLoginExpression;
}

@Override
public String errorPage() {
return errorPage;
}

}

/**
* The resource (page) a caller should get to see in case the originally requested
* resource requires authentication, and the caller is currently not authenticated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.lang.annotation.Target;

import javax.el.ELProcessor;
import javax.enterprise.util.AnnotationLiteral;
import javax.enterprise.util.Nonbinding;
import javax.interceptor.InterceptorBinding;
import javax.security.enterprise.identitystore.IdentityStore;
Expand Down Expand Up @@ -83,173 +82,6 @@
@Target(TYPE)
public @interface RememberMe {

/**
* A default literal type for the {@link RememberMe} annotation.
*
* @since 1.1
*/
@SuppressWarnings("all")
public final static class Literal extends AnnotationLiteral<RememberMe> implements RememberMe {

private static final long serialVersionUID = 1L;

private final int cookieMaxAgeSeconds;
private final String cookieMaxAgeSecondsExpression;
private final boolean cookieSecureOnly;
private final String cookieSecureOnlyExpression;
private final boolean cookieHttpOnly;
private final String cookieHttpOnlyExpression;
private final String cookieName;
private final boolean isRememberMe;
private final String isRememberMeExpression;

public static LiteralBuilder builder() {
return new LiteralBuilder();
}

public static class LiteralBuilder {

private int cookieMaxAgeSeconds = 86400; // 1 day
private String cookieMaxAgeSecondsExpression;
private boolean cookieSecureOnly = true;
private String cookieSecureOnlyExpression;
private boolean cookieHttpOnly = true;
private String cookieHttpOnlyExpression;
private String cookieName = "JREMEMBERMEID";
private boolean isRememberMe = true;
private String isRememberMeExpression;

public LiteralBuilder cookieMaxAgeSeconds(int cookieMaxAgeSeconds) {
this.cookieMaxAgeSeconds = cookieMaxAgeSeconds;
return this;
}

public LiteralBuilder cookieMaxAgeSecondsExpression (String cookieMaxAgeSecondsExpression) {
this.cookieMaxAgeSecondsExpression = cookieMaxAgeSecondsExpression;
return this;
}

public LiteralBuilder cookieSecureOnly (boolean cookieSecureOnly) {
this.cookieSecureOnly = cookieSecureOnly;
return this;

}

public LiteralBuilder cookieSecureOnlyExpression (String cookieSecureOnlyExpression) {
this.cookieHttpOnlyExpression = cookieSecureOnlyExpression;
return this;
}

public LiteralBuilder cookieHttpOnly (boolean cookieHttpOnly) {
this.cookieHttpOnly = cookieHttpOnly;
return this;
}

public LiteralBuilder cookieHttpOnlyExpression (String cookieHttpOnlyExpression) {
this.cookieHttpOnlyExpression = cookieHttpOnlyExpression;
return this;
}

public LiteralBuilder cookieName (String cookieName) {
this.cookieName = cookieName;
return this;
}

public LiteralBuilder isRememberMe (boolean isRememberMe) {
this.isRememberMe = isRememberMe;
return this;
}

public LiteralBuilder isRememberMeExpression (String isRememberMeExpression) {
this.isRememberMeExpression = isRememberMeExpression;
return this;
}

public Literal build() {
return new Literal(
cookieMaxAgeSeconds,
cookieMaxAgeSecondsExpression,
cookieSecureOnly,
cookieSecureOnlyExpression,
cookieHttpOnly,
cookieHttpOnlyExpression,
cookieName,
isRememberMe,
isRememberMeExpression);
}
}

public Literal(

int cookieMaxAgeSeconds,
String cookieMaxAgeSecondsExpression,
boolean cookieSecureOnly,
String cookieSecureOnlyExpression,
boolean cookieHttpOnly,
String cookieHttpOnlyExpression,
String cookieName,
boolean isRememberMe,
String isRememberMeExpression

) {

this.cookieMaxAgeSeconds = cookieMaxAgeSeconds;
this.cookieMaxAgeSecondsExpression = cookieMaxAgeSecondsExpression;
this.cookieSecureOnly = cookieSecureOnly;
this.cookieSecureOnlyExpression = cookieSecureOnlyExpression;
this.cookieHttpOnly = cookieHttpOnly;
this.cookieHttpOnlyExpression = cookieHttpOnlyExpression;
this.cookieName = cookieName;
this.isRememberMe = isRememberMe;
this.isRememberMeExpression = isRememberMeExpression;
}

@Override
public boolean cookieHttpOnly() {
return cookieHttpOnly;
}

@Override
public String cookieHttpOnlyExpression() {
return cookieHttpOnlyExpression;
}

@Override
public int cookieMaxAgeSeconds() {
return cookieMaxAgeSeconds;
}

@Override
public String cookieMaxAgeSecondsExpression() {
return cookieMaxAgeSecondsExpression;
}

@Override
public boolean cookieSecureOnly() {
return cookieSecureOnly;
}

@Override
public String cookieSecureOnlyExpression() {
return cookieSecureOnlyExpression;
}

@Override
public String cookieName() {
return cookieName;
}

@Override
public boolean isRememberMe() {
return isRememberMe;
}

@Override
public String isRememberMeExpression() {
return isRememberMeExpression;
}
}

/**
* Max age in seconds for the remember me cookie.
* Defaults to one day.
Expand Down
Loading

0 comments on commit d7ac24f

Please sign in to comment.