Merge "Tokenized REST API POST handler"

This commit is contained in:
Shawn Pearce
2012-08-15 12:30:42 -07:00
committed by gerrit code review
12 changed files with 575 additions and 71 deletions

View File

@@ -45,6 +45,7 @@ public class AuthConfig {
private final String cookiePath;
private final boolean cookieSecure;
private final SignedToken emailReg;
private final SignedToken restToken;
private final boolean allowGoogleAccountUpgrade;
@@ -75,6 +76,15 @@ public class AuthConfig {
emailReg = null;
}
key = cfg.getString("auth", null, "restTokenPrivateKey");
if (key != null && !key.isEmpty()) {
int age = (int) ConfigUtil.getTimeUnit(cfg,
"auth", null, "maxRestTokenAge", 60, TimeUnit.SECONDS);
restToken = new SignedToken(age, key);
} else {
restToken = null;
}
if (authType == AuthType.OPENID) {
allowGoogleAccountUpgrade =
cfg.getBoolean("auth", "allowgoogleaccountupgrade", false);
@@ -129,6 +139,10 @@ public class AuthConfig {
return emailReg;
}
public SignedToken getRestToken() {
return restToken;
}
public boolean isAllowGoogleAccountUpgrade() {
return allowGoogleAccountUpgrade;
}

View File

@@ -32,7 +32,7 @@ import java.util.List;
/** A version of the database schema. */
public abstract class SchemaVersion {
/** The current schema version. */
public static final Class<Schema_71> C = Schema_71.class;
public static final Class<Schema_72> C = Schema_72.class;
public static class Module extends AbstractModule {
@Override

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2012 The Android Open Source Project
//
// 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 com.google.gerrit.server.schema;
import com.google.inject.Inject;
import com.google.inject.Provider;
public class Schema_72 extends SchemaVersion {
@Inject
Schema_72(Provider<Schema_71> prior) {
super(prior);
}
}