Examples of ProjectAuthorization


Examples of org.platformlayer.model.ProjectAuthorization

  @Inject
  Provider<Scope> scopeProvider;

  @Override
  public ProjectAuthorization get() {
    ProjectAuthorization authentication = null;

    Scope scope = scopeProvider.get();
    if (scope != null) {
      authentication = scope.get(ProjectAuthorization.class);
    }
View Full Code Here

Examples of org.platformlayer.model.ProjectAuthorization

    if (authn == null) {
      throw new OpsException(message);
    }

    ProjectAuthorization authz = authenticationTokenValidator.validateToken(authn, projectKey);
    if (authz == null) {
      throw new OpsException(message);
    }

    // {
View Full Code Here

Examples of org.platformlayer.model.ProjectAuthorization

    }
    return result.authorization;
  }

  protected CachedResult loadForCache(CacheKey key) {
    ProjectAuthorization authorization;
    if (key.token != null) {
      authorization = inner.validateToken(key.token, key.projectKey);
    } else {
      authorization = inner.validateChain(key.chain.buildCertificates(), key.projectKey);
    }
View Full Code Here

Examples of org.platformlayer.model.ProjectAuthorization

      AuthenticationTokenValidator authTokenValidator, String projectKey) {
    if (authn == null) {
      return null;
    }

    ProjectAuthorization authz = null;
    if (authn instanceof ProjectAuthorization) {
      authz = (ProjectAuthorization) authn;
    } else if (authn instanceof CertificateAuthenticationCredentials) {
      authz = authTokenValidator.validateChain(((CertificateAuthenticationCredentials) authn).getCertChain(),
          projectKey);
    } else {
      authz = authTokenValidator.validateToken(authn.getToken(), projectKey);
    }

    if (authz == null || !Objects.equal(authz.getName(), projectKey)) {
      return null;
    }

    return authz;
  }
View Full Code Here

Examples of org.platformlayer.model.ProjectAuthorization

    if (chain == null) {
      AuthenticationTokenValidator authenticationTokenValidator = OpsContext.get().getInjector()
          .getInstance(AuthenticationTokenValidator.class);

      ProjectAuthorization projectAuthorization = Scope.get().get(ProjectAuthorization.class);
      String projectKey = projectAuthorization.getName();

      if (!projectKey.equals(projectId.getKey())) {
        throw new IllegalStateException();
      }

      PlatformLayerAuthAdminClient adminClient = PlatformLayerAuthAdminClient.find(authenticationTokenValidator);
      Csr csr = Csr.buildCsr(keyPair, getX500Principal());
      chain = adminClient.signCsr(projectId.getKey(), projectAuthorization.getProjectSecret(), csr.getEncoded());

      privateData.putCertificate(projectId, null, METADATA_PROJECT_CERT, chain);
    }

    // privateData.getOrCreate(projectId, null, sshKeyName, user)
View Full Code Here

Examples of org.platformlayer.model.ProjectAuthorization

    // if (delta > MAX_TIMESTAMP_SKEW) {
    // // If the times are out of sync, that isn't a secret
    // throw new SecurityException("Timestamp skew too large");
    // }

    ProjectAuthorization project = null;

    String projectPrefix = DirectAuthenticationToken.PREFIX;

    if (authKey.startsWith(projectPrefix)) {
      List<String> projectTokens = Lists.newArrayList(Splitter.on(':').limit(3).split(authKey));
View Full Code Here

Examples of org.platformlayer.model.ProjectAuthorization

    return null;
  }

  public static DirectAuthentication build(final String projectKey, final int projectId, final CryptoKey projectSecret) {
    ProjectAuthorization project = new ProjectAuthorization() {
      @Override
      public boolean isLocked() {
        return projectSecret == null;
      }
View Full Code Here

Examples of org.platformlayer.model.ProjectAuthorization

    RenameThread rename = new RenameThread(action.getClass().getSimpleName() + " " + targetItemKey);
    try {
      OpsContextBuilder opsContextBuilder = opsSystem.getInjector().getInstance(OpsContextBuilder.class);

      final ProjectAuthorization project = activeJob.getProjectAuthorization();

      final OpsContext opsContext = opsContextBuilder.buildOpsContext(activeJob);

      final ServiceType serviceType = activeJob.getServiceType();
      final ServiceProvider serviceProvider = opsSystem.getServiceProvider(serviceType);
View Full Code Here

Examples of org.platformlayer.model.ProjectAuthorization

  @Inject
  JobRegistry jobRegistry;

  public ProjectId getRunAsProjectId(ProjectAuthorization project) throws OpsException {
    ProjectAuthorization runAsProject = project; // authentication.getProject();

    MultitenantConfiguration multitenant = opsSystem.getMultitenantConfiguration();
    if (multitenant != null) {
      runAsProject = multitenant.getMasterProject();
    }

    ProjectId runAsProjectId = new ProjectId(runAsProject.getName());
    return runAsProjectId;
  }
View Full Code Here

Examples of org.platformlayer.model.ProjectAuthorization

    return runAsProjectId;
  }

  public OpsContext buildOpsContext(ActiveJobExecution activeJob) throws OpsException {
    ServiceType serviceType = activeJob.getServiceType();
    ProjectAuthorization projectAuthz = activeJob.getProjectAuthorization();

    List<ProjectAuthorization> projects = Lists.newArrayList();

    ProjectAuthorization runAsProject = projectAuthz; // .getProject();
    projects.add(runAsProject);

    MultitenantConfiguration multitenant = opsSystem.getMultitenantConfiguration();
    if (multitenant != null) {
      ProjectAuthorization masterProject = multitenant.getMasterProject();
      if (runAsProject.getName().equals(masterProject.getName())) {
        // We're in the master project
        multitenant = null;
      } else {
        runAsProject = masterProject;
        projects.add(runAsProject);
      }
    }

    TypedPlatformLayerClient defaultClient = buildClient(runAsProject);

    FederationConfiguration federationMapConfig = FederatedPlatformLayerClient
        .buildFederationConfiguration(defaultClient);

    FederationMap federationMap = new FederationMap(httpStrategy, mapper, federationMapConfig);

    if (multitenant != null) {
      ProjectAuthorization localProject = projectAuthz; // .getProject();
      TypedPlatformLayerClient localClient = buildClient(localProject);

      FederationKey host = FederationKey.LOCAL;
      ProjectId project = localClient.getProject();
      FederationMapping mapKey = new FederationMapping(host, project);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.