Skip to content

Commit

Permalink
Improving the credentials schema
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Nov 2, 2016
1 parent 50fc266 commit c71f7a8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Expand Up @@ -171,7 +171,7 @@ public OperationResult run() {
private void assignAdditionalRoleIfPresent(String userOid, UsernamePasswordAuthenticationToken token, NonceType nonceType, OperationResult result){
SecurityContextHolder.getContext().setAuthentication(token);
List<ItemDelta> userDeltas = new ArrayList<>();
if (nonceType.getResetType() != null) {
if (nonceType.getName() != null) {

Task task = createSimpleTask(OPERATION_FINISH_REGISTRATION);

Expand All @@ -180,7 +180,7 @@ private void assignAdditionalRoleIfPresent(String userOid, UsernamePasswordAuthe
try {
AssignmentType assignment = new AssignmentType();
assignment.setTargetRef(
ObjectTypeUtil.createObjectRef(nonceType.getResetType(), ObjectTypes.ABSTRACT_ROLE));
ObjectTypeUtil.createObjectRef(nonceType.getName(), ObjectTypes.ABSTRACT_ROLE));
getPrismContext().adopt(assignment);
userDeltas.add((ItemDelta) ContainerDelta.createModificationAdd(UserType.F_ASSIGNMENT,
UserType.class, getPrismContext(), assignment));
Expand Down
Expand Up @@ -420,7 +420,7 @@ private UserType prepareUserToSave(Task task,
if (namedParameters != null && !namedParameters.isEmpty()) {
NamedPair firstParam = namedParameters.iterator().next();
if (firstParam != null) {
nonceType.setResetType(firstParam.getValue());
nonceType.setName(firstParam.getValue());
}
}
}
Expand Down
Expand Up @@ -2584,6 +2584,18 @@
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Name of the credential. It is used as an identifier that
specifies credential purpose. E.g. it may specify whether
this is default user password or administration password,
whether this is a nonce for registration or password reset
and so on. Simply speaking the name is used to distinguish
credetials that have the same type but different purpose.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="failedLogins" type="xsd:int" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Expand Down Expand Up @@ -2664,7 +2676,6 @@
<xsd:extension base="tns:AbstractCredentialType">
<xsd:sequence>
<xsd:element name="value" type="t:ProtectedStringType" minOccurs="0"/>
<xsd:element name="resetType" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
Expand Down

0 comments on commit c71f7a8

Please sign in to comment.