ConfigureOAuth2.java revision 100d882219e8f87f6253fa08a4b7bde5a6e97f08
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2012-2014 ForgeRock AS.
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
*
* Portions Copyrighted 2012-2014 ForgeRock AS
*/
public class ConfigureOAuth2 extends Task {
private static final String AUTHZ_CODE_LIFETIME_NAME = "forgerock-oauth2-provider-authorization-code-lifetime";
private static final String REFRESH_TOKEN_LIFETIME_NAME = "forgerock-oauth2-provider-refresh-token-lifetime";
private static final String ACCESS_TOKEN_LIFETIME_NAME = "forgerock-oauth2-provider-access-token-lifetime";
private static final String ISSUE_REFRESH_TOKEN_ON_REFRESHING_TOKEN = "forgerock-oauth2-provider-issue-refresh-token-on-refreshing-token";
private static final String SCOPE_PLUGIN_CLASS= "forgerock-oauth2-provider-scope-implementation-class";
//params
//service params
//policy params
private final PolicyStoreProvider storeProvider;
public ConfigureOAuth2(){
}
//replace service attributes
attrValues.put(ISSUE_REFRESH_TOKEN_ON_REFRESHING_TOKEN, Collections.singleton(getString(params, IRTR)));
//check if policy exists
boolean createPolicy = false;
try {
createPolicy = true;
}
} catch (Exception e){
createPolicy = true;
}
if (createPolicy){
try {
PolicyStore policyStore = storeProvider.getPolicyStore(SubjectUtils.createSuperAdminSubject(), ROOT);
} catch (EntitlementException e) {
throw new WorkflowException("ConfigureOAuth2.execute() : Unable to create policy");
}
}
MessageFormat.format(getMessage(createPolicy ? POLICY_CREATED : POLICY_EXISTS, locale), POLICY_NAME));
}
private Map<String, Set<String>> getDefaultOAuth2ProviderAttributes(SSOToken token) throws WorkflowException {
try {
final ServiceSchema serviceSchema = new ServiceSchemaManager(SERVICE_NAME, token).getOrganizationSchema();
} catch (SMSException e) {
} catch (SSOException e) {
}
}
private void createOAuth2Provider(SSOToken token, String realm, Map<String, Set<String>> attrValues)
throws WorkflowException {
try {
} catch (SMSException e) {
} catch (SSOException e) {
}
}
}