org.picketlink.idm.spi.IdentityStore Maven / Gradle / Ivy
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* Licensed 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.picketlink.idm.spi;
import org.picketlink.idm.config.IdentityStoreConfiguration;
import org.picketlink.idm.credential.Credentials;
import org.picketlink.idm.model.Account;
import org.picketlink.idm.model.AttributedType;
import org.picketlink.idm.model.IdentityType;
import org.picketlink.idm.model.Relationship;
import org.picketlink.idm.query.IdentityQuery;
import org.picketlink.idm.query.RelationshipQuery;
import java.util.Date;
import java.util.List;
/**
* IdentityStore representation providing minimal SPI
*
* @author Boleslaw Dawidowicz
* @author Shane Bryzak
*/
public interface IdentityStore {
/**
* Sets the configuration and context in which the IdentityStore will execute its operations
*
* @param config
* @param context
*/
void setup(T config);
/**
* Returns the configuration for this IdentityStore instance
*
* @return
*/
T getConfig();
// General
/**
* Persists the specified IdentityType
*
* @param identityType
*/
void add(IdentityContext context, AttributedType value);
/**
* Updates the specified IdentityType
*
* @param identityType
*/
void update(IdentityContext context, AttributedType value);
/**
* Removes the specified IdentityType
*
* @param identityType
*/
void remove(IdentityContext context, AttributedType value);
// Identity query
List fetchQueryResults(IdentityContext context, IdentityQuery identityQuery);
int countQueryResults(IdentityContext context, IdentityQuery identityQuery);
// Relationship query
List fetchQueryResults(IdentityContext context, RelationshipQuery query);
int countQueryResults(IdentityContext context, RelationshipQuery query);
// Credentials
/**
* Validates the specified credentials. Each IdentityStore implementation typically supports
* a concrete set of Credentials types, and will generally obtain a CredentialHandler instance
* from the IdentityStoreInvocationContext to process credential validation.
*
* @param credentials
*/
void validateCredentials(IdentityContext context, Credentials credentials);
/**
* Updates the specified credential value for the specified Agent.
*
* @param agent
* @param credential
*/
void updateCredential(IdentityContext context, Account account, Object credential, Date effectiveDate, Date expiryDate);
}