/** * @return The authorization strategy for this session */ public IAuthorizationStrategy getAuthorizationStrategy() { return getApplication().getSecuritySettings().getAuthorizationStrategy(); }
/** * @see org.apache.wicket.jmx.SecuritySettingsMBean#getAuthorizationStrategy() */ @Override public String getAuthorizationStrategy() { return Stringz.className(application.getSecuritySettings().getAuthorizationStrategy()); }
/** * @see org.apache.wicket.jmx.SecuritySettingsMBean#getCryptFactory() */ @Override public String getCryptFactory() { return Stringz.className(application.getSecuritySettings().getCryptFactory()); }
/** * @see org.apache.wicket.jmx.SecuritySettingsMBean#getUnauthorizedComponentInstantiationListener() */ @Override public String getUnauthorizedComponentInstantiationListener() { return Stringz.className(application.getSecuritySettings() .getUnauthorizedComponentInstantiationListener()); } }
/** * @return The authorization strategy for this session */ public IAuthorizationStrategy getAuthorizationStrategy() { return getApplication().getSecuritySettings().getAuthorizationStrategy(); }
/** * @return The authorization strategy for this session */ public IAuthorizationStrategy getAuthorizationStrategy() { return getApplication().getSecuritySettings().getAuthorizationStrategy(); }
/** * @return The authorization strategy for this session */ public IAuthorizationStrategy getAuthorizationStrategy() { return getApplication().getSecuritySettings().getAuthorizationStrategy(); }
protected IAuthorizationStrategy getAuthorizationStrategy() { return Application.get().getSecuritySettings().getAuthorizationStrategy(); } }
/** * Encrypt with {@link org.apache.wicket.settings.SecuritySettings#getCryptFactory()}. * <p> * <strong>Important</strong>: Encryption is done with {@link org.apache.wicket.settings.SecuritySettings#DEFAULT_ENCRYPTION_KEY} if you haven't * configured an alternative {@link ICryptFactory}. For better security it is recommended to use * {@link CryptoMapper#CryptoMapper(IRequestMapper, Supplier)} with a specific {@link ICrypt} implementation * that generates a separate key for each user. * {@link org.apache.wicket.core.util.crypt.KeyInSessionSunJceCryptFactory} provides such an implementation that stores the * key in the HTTP session. * </p> * * @param wrappedMapper * the non-crypted request mapper * @param application * the current application * @see org.apache.wicket.util.crypt.SunJceCrypt */ public CryptoMapper(final IRequestMapper wrappedMapper, final Application application) { this(wrappedMapper, () -> application.getSecuritySettings().getCryptFactory().newCrypt()); }
/** * Encrypt with {@link org.apache.wicket.settings.SecuritySettings#getCryptFactory()}. * <p> * <strong>Important</strong>: Encryption is done with {@link org.apache.wicket.settings.SecuritySettings#DEFAULT_ENCRYPTION_KEY} if you haven't * configured an alternative {@link ICryptFactory}. For better security it is recommended to use * {@link CryptoMapper#CryptoMapper(IRequestMapper, Supplier)} with a specific {@link ICrypt} implementation * that generates a separate key for each user. * {@link org.apache.wicket.core.util.crypt.KeyInSessionSunJceCryptFactory} provides such an implementation that stores the * key in the HTTP session. * </p> * * @param wrappedMapper * the non-crypted request mapper * @param application * the current application * @see org.apache.wicket.util.crypt.SunJceCrypt */ public CryptoMapper(final IRequestMapper wrappedMapper, final Application application) { this(wrappedMapper, () -> application.getSecuritySettings().getCryptFactory().newCrypt()); }
/** * Persister defaults are maintained centrally by the Application. * * @return Persister default value */ private CookieValuePersisterSettings getSettings() { return RequestCycle.get() .getApplication() .getSecuritySettings() .getCookieValuePersisterSettings(); }
/** * @see org.apache.wicket.application.IComponentInstantiationListener#onInstantiation(org.apache.wicket.Component) */ @Override public void onInstantiation(final Component component) { final Class<? extends Component> cl = component.getClass(); // If component instantiation is not authorized if (!Session.get().getAuthorizationStrategy().isInstantiationAuthorized(cl)) { // then call any unauthorized component instantiation // listener getSecuritySettings().getUnauthorizedComponentInstantiationListener() .onUnauthorizedInstantiation(component); } } });
/** * @see org.apache.wicket.application.IComponentInstantiationListener#onInstantiation(org.apache.wicket.Component) */ @Override public void onInstantiation(final Component component) { final Class<? extends Component> cl = component.getClass(); // If component instantiation is not authorized if (!Session.get().getAuthorizationStrategy().isInstantiationAuthorized(cl)) { // then call any unauthorized component instantiation // listener getSecuritySettings().getUnauthorizedComponentInstantiationListener() .onUnauthorizedInstantiation(component); } } });
/** * @see org.apache.wicket.application.IComponentInstantiationListener#onInstantiation(org.apache.wicket.Component) */ public void onInstantiation(final Component component) { final Class<? extends Component> cl = component.getClass(); // If component instantiation is not authorized if (!Session.get().getAuthorizationStrategy().isInstantiationAuthorized(cl)) { // then call any unauthorized component instantiation // listener getSecuritySettings().getUnauthorizedComponentInstantiationListener() .onUnauthorizedInstantiation(component); } } });
/** * @see org.apache.wicket.application.IComponentInstantiationListener#onInstantiation(org.apache.wicket.Component) */ public void onInstantiation(final Component component) { // If component instantiation is not authorized if (!Session.get().getAuthorizationStrategy().isInstantiationAuthorized( component.getClass())) { // then call any unauthorized component instantiation // listener getSecuritySettings().getUnauthorizedComponentInstantiationListener() .onUnauthorizedInstantiation(component); } } });
/** * Call signOut() and remove the logon data from whereever they have been persisted (e.g. * Cookies) * * @see org.apache.wicket.Session#invalidate() */ @Override public void invalidate() { if (isSessionInvalidated() == false) { getApplication().getSecuritySettings().getAuthenticationStrategy().remove(); super.invalidate(); } }
/** * Call signOut() and remove the logon data from whereever they have been persisted (e.g. * Cookies) * * @see org.apache.wicket.Session#invalidate() */ @Override public void invalidate() { if (isSessionInvalidated() == false) { getApplication().getSecuritySettings().getAuthenticationStrategy().remove(); super.invalidate(); } }
private void authorize() { IAuthorizationStrategy authorizationStrategy = null; if (Session.exists()) { authorizationStrategy = Session.get().getAuthorizationStrategy(); } else if (Application.exists()) { authorizationStrategy = Application.get().getSecuritySettings().getAuthorizationStrategy(); } if (authorizationStrategy != null && authorizationStrategy.isResourceAuthorized(resource, parameters) == false) { if (Application.exists()) { Application.get().getSecuritySettings().getUnauthorizedResourceRequestListener().onUnauthorizedRequest(resource, parameters); } else { new DefaultUnauthorizedResourceRequestListener().onUnauthorizedRequest(resource, parameters); } } }
@Override protected void onConfigure() { if (!AuthenticatedWebSession.get().isSignedIn()) { IAuthenticationStrategy authenticationStrategy = getApplication().getSecuritySettings() .getAuthenticationStrategy(); String[] data = authenticationStrategy.load(); if ((data != null) && (data.length > 1)) { if (OrienteerWebSession.get().signIn(data[0], data[1])) { name.setObject(data[0]); passwordModel.setObject(data[1]); onSuccessLogin(); } else authenticationStrategy.remove(); } } super.onConfigure(); }
@Override protected void onSubmit(final AjaxRequestTarget target) { if (SyncopeWebApplication.get().getAnonymousUser().equals(usernameField.getRawInput())) { throw new AccessControlException("Illegal username"); } IAuthenticationStrategy strategy = getApplication().getSecuritySettings().getAuthenticationStrategy(); if (AuthenticatedWebSession.get().signIn(usernameField.getRawInput(), passwordField.getRawInput())) { // If login has been called because the user was not yet logged in, than continue to the // original destination, otherwise to the Home page continueToOriginalDestination(); setResponsePage(getApplication().getHomePage()); } else { SyncopeConsoleSession.get().error(getString("login-error")); notificationPanel.refresh(target); } strategy.remove(); } };