org.apache.jackrabbit.api.security.user.User Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aem-sdk-api Show documentation
Show all versions of aem-sdk-api Show documentation
The Adobe Experience Manager SDK
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jackrabbit.api.security.user;
import javax.jcr.Credentials;
import javax.jcr.RepositoryException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.osgi.annotation.versioning.ProviderType;
/**
* User is a special {@link Authorizable} that can be authenticated and
* impersonated.
*
* @see #getCredentials()
* @see #getImpersonation()
*/
@ProviderType
public interface User extends Authorizable {
/**
* @return true if the current user represents the administrator.
*/
boolean isAdmin();
/**
* @return true if the current user represents a system user.
*/
boolean isSystemUser();
/**
* Returns the internal Credentials
representation for this
* user. This method is expected to be used for validation during the
* login process. However, the return value should neither be usable nor
* used for {@link javax.jcr.Repository#login}.
*
* @return Credentials
for this user.
* @throws javax.jcr.RepositoryException If an error occurs.
*/
@NotNull
Credentials getCredentials() throws RepositoryException;
/**
* @return Impersonation
for this User
.
* @throws javax.jcr.RepositoryException If an error occurs.
*/
@NotNull
Impersonation getImpersonation() throws RepositoryException;
/**
* Change the password of this user.
*
* @param password The new password.
* @throws RepositoryException If an error occurs.
*/
void changePassword(@Nullable String password) throws RepositoryException;
/**
* Change the password of this user.
*
* @param password The new password.
* @param oldPassword The old password.
* @throws RepositoryException If the old password doesn't match or if
* an error occurs.
*/
void changePassword(@Nullable String password, @NotNull String oldPassword) throws RepositoryException;
/**
* Disable this user thus preventing future login if the reason
* is a non-null String.
* Note however, that this user will still be accessible by
* {@link UserManager#getAuthorizable}.
*
* @param reason String describing the reason for disable this user or
* null
if the user account should be enabled again.
* @throws RepositoryException If an error occurs.
*/
void disable(@Nullable String reason) throws RepositoryException;
/**
* Returns true
if this user is disabled, false
* otherwise.
*
* @return true
if this user is disabled, false
* otherwise.
* @throws RepositoryException If an error occurs.
*/
boolean isDisabled() throws RepositoryException;
/**
* Returns the String specified upon disabling this user or null
* if {@link #isDisabled()} returns false
.
*
* @return The reason specified upon disabling this user or null
* if this user is not disabled.
* @throws RepositoryException If an error occurs.
*/
@Nullable
String getDisabledReason() throws RepositoryException;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy