All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.imunity.scim.SCIMSystemScopeProvider Maven / Gradle / Ivy

There is a newer version: 4.0.3
Show newest version
/*
 * Copyright (c) 2021 Bixbit - Krzysztof Benedyczak. All rights reserved.
 * See LICENCE.txt file for licensing information.
 */

package io.imunity.scim;

import java.util.List;
import java.util.Set;

import org.springframework.stereotype.Component;

import pl.edu.icm.unity.base.message.MessageSource;
import pl.edu.icm.unity.oauth.api.Scope;
import pl.edu.icm.unity.oauth.api.SystemScopeProvider;

@Component
public class SCIMSystemScopeProvider implements SystemScopeProvider
{
	private static final String id = "SCIM";

	public static final String READ_PROFILE_SCOPE = "sys:scim:read_profile";
	public static final String READ_MEMBERSHIPS_SCOPE = "sys:scim:read_memberships";
	public static final String READ_SELF_GROUP_SCOPE = "sys:scim:read_self_group";

	private final MessageSource msg;

	public SCIMSystemScopeProvider(MessageSource msg)
	{
		this.msg = msg;
	}

	@Override
	public List getScopes()
	{
		return List.of(
				Scope.builder().withName(READ_PROFILE_SCOPE)
						.withDescription(msg.getMessage("SCIMScopeProvider.readProfile")).build(),
				Scope.builder().withName(READ_MEMBERSHIPS_SCOPE)
						.withDescription(msg.getMessage("SCIMScopeProvider.readMembership")).build(),
				Scope.builder().withName(READ_SELF_GROUP_SCOPE)
						.withDescription(msg.getMessage("SCIMScopeProvider.readSelfGroup")).build());
	}

	@Override
	public String getId()
	{
		return id;
	}

	public static Set getScopeNames()
	{
		return Set.of(READ_MEMBERSHIPS_SCOPE, READ_PROFILE_SCOPE);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy